This calculates and displays means, confidence intervals as well as which groups are different based on Tukey's HSD. Inspired by http://stackoverflow.com/questions/18771516/is-there-a-function-to-add-aov-post-hoc-testing-results-to-ggplot2-boxplot
TukeyHSDgg(x, y, d, ci = 0.95, idvar, ...)
A ggplot graph object.
A categorical grouping variable name.
A continuous outcome variable name.
A dataset
A numeric value indicating the coverage of the confidence interval to use. Defaults to 0.95.
An optional ID variable for multilevel data
Additional arguments passed on.
## examples using it with single level data
## differences based on an ANOVA and follow up contrasts
mtcars$cyl <- factor(mtcars$cyl)
TukeyHSDgg("cyl", "mpg", mtcars)
rm(mtcars)
if (FALSE) {
TukeyHSDgg("Species", "Sepal.Length", iris)
## example based on multilevel data
## differences based on model fit with lmer and follow up contrasts
TukeyHSDgg("treatment", "decrease", OrchardSprays, idvar = "colpos")
}
Run the code above in your browser using DataLab