likert <- c(3, 1, 4, 1, 4, 6, 7, 2, 6, 6, 7)
# two-sided test (the default)
oneSampleTTest(x = likert, mu = 4)
# one-sided test: is the mean greater than 4?
oneSampleTTest(x = likert, mu = 4, one.sided = "greater")
# wider confidence interval
oneSampleTTest(x = likert, mu = 4, conf.level = 0.99)
# missing values are removed with a warning
likert <- c(3, NA, 4, NA, 4, 6, 7, NA, 6, 6, 7)
oneSampleTTest(x = likert, mu = 4)
Run the code above in your browser using DataLab