This page was last updated on September 23, 2019.


Tutorial 01: Visualizing and Describing Data

Getting started:

  • read.csv
  • url
  • library
  • getwd

Data frame structure:

  • names
  • head
  • str
  • inspect (tigerstats / mosaic packages)

Frequency tables:

  • xtabs
  • prop.table
  • rowPerc (tigerstats)
  • colPerc (tigerstats)

Graphs:

  • barchartGC (tigerstats / lattice packages)
  • histogram (tigerstats / lattice packages)
  • hist (base stats package)

Descriptive stats:

  • favstats (tigerstats and mosaic packages)
  • mean
  • median
  • var
  • sd
  • IQR

Tutorial 02: Visualizing associations between variables

Getting started:

  • read.csv
  • url
  • library
  • getwd

Data frame structure:

  • names
  • head
  • str
  • inspect (tigerstats / mosaic packages)

Contingency tables:

  • xtabs
  • addmargins
  • prop.table
  • rowPerc (tigerstats)
  • colPerc (tigerstats)

Graphs:

  • barchartGC (tigerstats / lattice packages)
  • mosaicplot
  • stripchart (lattice package)
  • xyplot (lattice package)
  • boxplot

Tutorial 03: Calculating descriptive statistics for one variable grouped by another

Getting started:

  • read.csv
  • url
  • library

Descriptive stats:

  • favtstats
  • mean

Tutorial 04: Sampling, Estimation, and Uncertainty

Getting started:

  • read.csv
  • url
  • library

Data frame structure:

  • head
  • str
  • inspect (tigerstats / mosaic packages)
  • length

Sampling:

  • set.seed
  • sample
  • do (mosaic package)

Data management and exploration:

  • filter (from the dplyr package)
  • subset
  • na.omit
  • length
  • mean
  • sd
  • sqrt

Graphs:

  • histogram
  • hist

Tutorial 05: Simulate random trials

Getting started:

  • library

Data frame structure:

  • head
  • str

Tabulation:

  • xtabs

Simulation:

  • set.seed
  • sample
  • do
  • rflip (from the mosaic package in the tigerstats package)

Graphs:

  • barplot (different from the barchartGC function used in previous tutorials)

Tutorial 06: Hypothesis testing

Getting started:

  • library

Data frame structure:

  • head
  • str

Tabulation:

  • xtabs

Simulation:

  • set.seed
  • sample
  • do
  • rflip (from the mosaic package in the tigerstats package)

Math:

  • sum

Graphs:

  • barplot (different from the barchartGC function used in previous tutorials)

Tutorial 07: Estimating proportions

Getting started:

  • library

Data frame structure:

  • str
  • inspect
  • length

Tabulation:

  • xtabs
  • prop.table

Simulation:

  • rep
  • set.seed
  • sample
  • do

Math:

  • sum
  • sqrt

Data management and exploration:

  • mean

Graphs:

  • barplot

Binomial distribution:

  • binom.confint (from the binom package)

Tutorial 08: Binomial distribution

Getting started:

  • library

Data frame structure:

  • str
  • inspect
  • names

Tabulation:

  • xtabs

Simulation:

  • set.seed
  • sample
  • do
  • seq

Math:

  • sum

Graphs:

  • barplot

Binomial distribution:

  • dbinom (base package)
  • binom.confint (from the binom package)
  • binom.test (from the binom package)

Tutorial 09: Goodness of fit tests

Getting started:

  • library

Data frame structure:

  • str
  • inspect

Create tables:

  • kable

Math:

  • sum
  • curve (base package)

Graphs:

  • barplot
  • segments

Goodness of fit:

  • dchisq (base package)
  • qchisq (base package)
  • chisqtestGC (from the tigerstats package)

Tutorial 10: Odds ratio

Getting started:

  • library

Data frame structure:

  • inspect

Tabulation:

  • xtabs

Manipulate data:

  • t (base package, for transposing matrix)

Graphs:

  • mosaicplot

Odds ratio:

  • oddsratio (from the epitools package)

Tutorial 11: Contingency analysis

Getting started:

  • library

Data frame structure:

  • inspect
  • names
  • levels

Tabulation:

  • xtabs
  • prop.table

Manipulate data:

  • t (base package, for transposing matrix)

Graphs:

  • mosaicplot

Contingency analysis:

  • fisher.test
  • chisq.test

Tutorial 12: The normal distribution

Getting started:

  • read.csv
  • url
  • library

Data frame structure:

  • head
  • inspect (tigerstats / mosaic packages)

Simulation:

  • set.seed
  • sample
  • do
  • mean

Normal distribution:

  • rnorm
  • pnormGC (tigerstats package)
  • qnormGC (tigerstats package)

Graphs:

  • histogram

Tutorial 13: Comparing one mean to a hypothesized value

Getting started:

  • read.csv
  • url
  • library

Data frame structure:

  • head
  • inspect (tigerstats / mosaic packages)

The “t” distribution:

  • pt
  • qt
  • t.test (mosaic package loaded as part of the tigerstats package)

Graphs:

  • histogram
  • hist

Tutorial 14: Comparing means among 2 groups or categories

Getting started:

  • read.csv
  • url
  • library

Data management / manipulation:

  • inspect (tigerstats / mosaic packages)
  • levels
  • filter (tidyr package)
  • xtabs (tigerstats / mosaic packages)

The “t” distribution:

  • qt
  • t.test (mosaic package loaded as part of the tigerstats package)

Graphs:

  • hist
  • boxplot
  • qqnorm
  • qqline
  • segments
  • par

Assumptions:

  • leveneTest (car package)
  • qqnorm
  • qqline
  • shapiro.test

Tutorial 15: Comparing means among more than 2 groups using ANOVA

Getting started:

  • read.csv
  • url
  • library

Data management / manipulation:

  • inspect (tigerstats / mosaic packages)
  • levels
  • head
  • xtabs (tigerstats / mosaic packages)
  • levels
  • ordered
  • names

Graphs:

  • stripchart
  • ggstripchart (from the ggpubr package)
  • qqnorm
  • qqline
  • par

Assumptions:

  • leveneTest (car package)

ANOVA:

  • lm
  • anova
  • summary

ANOVA Table:

  • names
  • colSums
  • as.data.frame
  • rbind
  • kable (knitr and kableExtra packages)

Post-hoc tests:

  • TukeyHSD
  • annotate (ggplot2 package, loaded with ggpubr package)

Tutorial 16: No longer exists; see Extra Tutorial: “Checking assumptions and data transformations”


Tutorial 17: Correlation analysis

Getting started:

  • read.csv
  • url
  • library

Data management / manipulation:

  • inspect (tigerstats / mosaic packages)
  • head

Graphs:

  • plot
  • jitter

Correlation:

  • cor.test

Tutorial 18: Regression analysis

Getting started:

  • read.csv
  • url
  • library

Data management / manipulation:

  • inspect (tigerstats / mosaic packages)
  • head

Data visualization:

  • plot
  • jitter

Assumptions:

  • qqnorm
  • qqline
  • residuals
  • shapiro.test
  • abline

Regression:

  • lm
  • summary
  • confint
  • visreg (from the visreg package)

Prediction:

  • predict.lm
  • seq
  • data.frame
  • sample
  • points

Extra tutorial: Tables in R Markdown

Getting started:

  • read.csv
  • url
  • library

Data frame structure:

  • names
  • inspect (tigerstats / mosaic packages)

Graphs:

  • stripchart (lattice package)

Descriptive stats:

  • favstats (tigerstats and mosaic packages)

Tables (all from the kableExtra package):

  • kable
  • kable_styling
  • add_header_above
  • kable_as_image

Extra tutorial: Checking assumptions and data transformations

Getting started:

  • read.csv
  • url
  • library

Testing assumptions:

  • head
  • hist
  • qqnorm
  • qqline
  • par
  • plot
  • shapiro.test
  • leveneTest (from the car package)
  • inspect (from the tigerstats package)

Transformations:

  • log
  • log10
  • logit (from the car package)
  • invlogit (from the arm package)
  • exp

Extra tutorial: Checking assumptions and data transformations