The goal of ggsimplestats is to provide an easy interface to add statistics to boxplot created with ggplot2
You can install the development version of ggsimplestats like so:
# install.packages("devtools")
devtools::install_github("maximilian-heeg/ggsimplestats")
This is a minimal example of how to add the statistics to a plot. In
this example we use the PlantGrowth dataset.
library(ggplot2)
library(ggsimplestats)
theme_set(ggthemes::theme_few())
ggplot(PlantGrowth, aes(group, weight, fill=group)) +
geom_boxplot() +
stat_kwAllPairsDunnTest()

Currently, four different tests are supported.
stat_tukeyHSD performes a TukeyHSD posthoc test on a anova.stat_mixedModel creates a mixed model with lmer using
y ~ x + (1|group).
In a second step, significanes are calcuated using
pairs(emmeans(model ~ x)).stat_kwAllPairsDunnTest uses PMCMRplus::kwAllPairsDunnTest()
to perform Dunn’s non-parametric all-pairs comparison test for
Kruskal-type ranked datastat_frdAllPairsNemenyiTest uses
PMCMRplus::frdAllPairsNemenyiTest() to perform Nemenyi’s
all-pairs comparisons tests of Friedman-type ranked dataFor further information please see the vignette("ggsimplestats").
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.