See stats::t.test
for details.
# S3 method for formula
t_test(formula, data, subset, na.action, ...)
a formula of the form lhs ~ rhs where lhs is a numeric variable giving the data values and rhs either 1 for a one-sample or paired test or a factor with two levels giving the corresponding groups. If lhs is of class "Pair" and rhs is 1, a paired test is done
an optional matrix or data frame (or similar: see model.frame) containing the variables in the formula formula. By default the variables are taken from environment(formula).
an optional vector specifying a subset of observations to be used.
a function which indicates what should happen when the data contain NAs. Defaults to getOption("na.action").
further arguments to be passed to or from methods.
t_test(mpg~vs, data = mtcars)$n
#> 0 1
#> 18 14