The ANOVA series: compare the means of three or more groups in R — one-way ANOVA, the normality and equal-variance assumptions, the omnibus F-test, and Tukey HSD / Games-Howell post-hoc tests — the tidy rstatix way, with base R shown.
When you need to compare the means of three or more groups, the t-test isn’t enough — running it on every pair inflates the false-positive rate. ANOVA (analysis of variance) does it with a single omnibus F-test, and a post-hoc step then tells you which groups differ. This series covers the ANOVA family the tidy rstatix way, with the base-R equivalent shown, and visualized with ggpubr.
ANOVA in one minute
The fastest path: make your grouping variable a factor, run anova_test() for the omnibus F-test, and read the p-value off a boxplot that prints it on the panel:
library(ggpubr)library(rstatix)tg <- ToothGrowthtg$dose <-factor(tg$dose)ggboxplot(tg, x ="dose", y ="len", fill ="dose", palette ="jco",xlab ="Vitamin C dose (mg)", ylab ="Tooth length") +labs(subtitle =get_test_label(tg %>%anova_test(len ~ dose), detailed =TRUE))
ANOVA Table (type II tests)
Effect DFn DFd F p p<.05 ges
1 dose 2 57 67.416 9.53e-16 * 0.703
A small p-value and a large ges effect size together say: the dose really does change tooth length — now run a post-hoc test to see which doses differ.
This series is filling in wave by wave — the one-way ANOVA first (assumptions, F-test, Tukey HSD + Games-Howell post-hoc), then the Kruskal-Wallis non-parametric alternative, two-way and repeated-measures ANOVA, and a “which test should I use?” decision guide.
🟢 With an AI agent
Ask Prova“do these groups have different means, and which pairs differ?” — it answers with rstatix code you can run on your own data, then helps you read the F-test, the effect size and the post-hoc table. The runtime is the judge.Ask Prova →
Was this page helpful?
Thanks for the feedback!
Prove you can do it. Master the whole ANOVA in R series — track your path, build projects, and earn a certificate.