library(tidyr)
# t test for number of hours worked per week
# by college degree status
gss %>%
tidyr::drop_na(college) %>%
t_test(formula = hours ~ college,
order = c("degree", "no degree"),
alternative = "two-sided")
# see vignette("infer") for more explanation of the
# intuition behind the infer package, and vignette("t_test")
# for more examples of t-tests using infer
Run the code above in your browser using DataLab