Run and interpret a two-way ANOVA in R with aov() — two factors plus their interaction — using the built-in ToothGrowth data, with an interaction plot.
Author
Rverse Analytics
Published
June 3, 2026
A one-way ANOVA compares groups on a single factor. A two-way ANOVA brings in a second factor and, crucially, their interaction — does the effect of one factor depend on the other? Here it is in R. (Comparing groups on one factor? Try the ANOVA calculator.)
The data
The built-in ToothGrowth data records tooth length in guinea pigs by supplement type (supp: OJ or VC) and dose (0.5, 1, 2 mg):
ToothGrowth$dose <-factor(ToothGrowth$dose)fit <-aov(len ~ supp * dose, data = ToothGrowth)summary(fit)
supp — the main effect of supplement type (averaged over dose).
dose — the main effect of dose (averaged over supplement).
supp:dose — the interaction: does the supplement effect change with dose? A significant interaction is often the most interesting result — and it means you should interpret the main effects with care.