A wrapper to stats::t.test() with var.equal = TRUE.

t_test(formula, data)

Arguments

formula

A two sided formula with one variable on either side, e.g. y ~ x, where the left hand side, dependent, variable is a numeric variable in data and the right hand side, independent, variable is a categorical or factor variable in data, and which has only two distinct values.

data

A data frame that contains the dependent and independent variables.

Value

A list with class "htest" as returned by stats::t.test().

Examples

t_test(trustworthy ~ face_sex, data = faithfulfaces)
#> 
#> 	Two Sample t-test
#> 
#> data:  trustworthy by face_sex
#> t = 1.9389, df = 168, p-value = 0.05419
#> alternative hypothesis: true difference in means between group female and group male is not equal to 0
#> 95 percent confidence interval:
#>  -0.004253649  0.471193782
#> sample estimates:
#> mean in group female   mean in group male 
#>             4.444061             4.210591 
#>