Learn R Programming

infer (version 0.3.1)

t_test: A tidier version of t.test for two sample tests

Description

A tidier version of t.test for two sample tests

Usage

t_test(data, formula, order = NULL, alternative = "two_sided", mu = 0,
  conf_int = TRUE, conf_level = 0.95, ...)

Arguments

data

a data frame that can be coerced into a tibble

formula

a formula with the response variable on the left and the explanatory on the right

order

#' @param order a string vector of specifying the order in which the levels of the explanatory variable should be ordered for subtraction, where order = c("first", "second") means ("first" - "second")

alternative

character string giving the direction of the alternative hypothesis. Options are "two_sided" (default), "greater", or "less".

mu

a numeric value giving the hypothesized null mean value for a one sample test and the hypothesized difference for a two sample test

conf_int

a logical value for whether to include the confidence interval or not. TRUE by default

conf_level

a numeric value between 0 and 1. Default value is 0.95

...

for passing in other arguments to stats::t.test

Examples

Run this code
# NOT RUN {
# t test for comparing mpg against automatic/manual
  mtcars %>%
    dplyr::mutate(am = factor(am)) %>%
    t_test(mpg ~ am, order = c("1", "0"), alternative = "less")
# }

Run the code above in your browser using DataLab