# NOT RUN {
## Kruskal-Wallis test example
# load data
data("Eredivisie")
# compute a Kruskual-Wallis test to investigate whether
# market values differ by playing position
kw <- kruskal_test(Eredivisie, "MarketValue",
group = "Position")
# convert to an object of class "SPSS_table" that
# contains the table with the test results
kw_spss <- to_SPSS(kw, statistics = "test")
kw_spss
# blank out the number of degrees of freedom to ask
# an assignment question about it
kw_spss$table[2, 1] <- "???"
# print the LaTeX table to be included in the assignment
to_latex(kw_spss)
## t test example
# load data
data("Exams")
# test whether the average grade on the resit
# differs from 5.5 (minimum passing grade)
t <- t_test(Exams, "Resit", mu = 5.5)
# convert to an object of class "SPSS_table" that
# contains the table with the test results
t_spss <- to_SPSS(t, statistics = "test")
# this is an example of a complex header layout
t_spss$header
# add additional line breaks in bottom-level header
t_spss$header[[3]] <- gsub("-", "-\n", t_spss$header[[3]],
fixed = TRUE)
# print the LaTeX table
to_latex(t_spss)
# }
Run the code above in your browser using DataLab