The objective of this package is to perform statistical inference using an expressive statistical grammar that coheres with the tidyverse design framework.


To install the current stable version of infer from CRAN:


To install the developmental version of infer, make sure to install remotes first:



These examples assume that mtcars has been overwritten so that the variables cyl, vs, am, gear, and carb are factors.

mtcars <- %>%
  mutate(cyl = factor(cyl),
          vs = factor(vs),
          am = factor(am),
          gear = factor(gear),
          carb = factor(carb))

Hypothesis test for a difference in proportions:

mtcars %>%
  specify(am ~ vs, success = "1") %>%
  hypothesize(null = "independence") %>%
  generate(reps = 100, type = "permute") %>%
  calculate(stat = "diff in props", order = c("1", "0"))

Confidence interval for a difference in means:

mtcars %>%
  specify(mpg ~ am) %>%
  generate(reps = 100, type = "bootstrap") %>%
  calculate(stat = "diff in means", order = c("1", "0"))

Other examples are available in the package vignettes.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.