Tukey Honest Significant Differences
Provides a pipe-friendly framework to performs Tukey post-hoc
tests. Wrapper around the function TukeyHSD()
. It is
essentially a t-test that corrects for multiple testing.
Can handle different inputs formats: aov, lm, formula.
tukey_hsd(x, ...) ## Default S3 method: tukey_hsd(x, ...) ## S3 method for class 'lm' tukey_hsd(x, ...) ## S3 method for class 'data.frame' tukey_hsd(x, formula, ...)
x |
an object of class |
... |
other arguments passed to the function
|
formula |
a formula of the form |
data |
a data.frame containing the variables in the formula. |
a tibble data frame containing the results of the different comparisons.
default
: performs tukey post-hoc test from aov()
results.
lm
: performs tukey post-hoc test from lm()
model.
data.frame
: performs tukey post-hoc tests using data and formula as
inputs. ANOVA will be automatically performed using the function
aov()
# Data preparation df <- ToothGrowth df$dose <- as.factor(df$dose) # Tukey HSD from ANOVA results aov(len ~ dose, data = df) %>% tukey_hsd() # two-way anova with interaction aov(len ~ dose*supp, data = df) %>% tukey_hsd() # Tukey HSD from lm() results lm(len ~ dose, data = df) %>% tukey_hsd() # Tukey HSD from data frame and formula tukey_hsd(df, len ~ dose) # Tukey HSD using grouped data df %>% group_by(supp) %>% tukey_hsd(len ~ dose)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.