Helper function to perform Tukey post-hoc tests. It is used in gafem .
tukey_hsd(model,..., out ="long")
Arguments
model: an object of class aov or lm.
...: other arguments passed to the function stats::TukeyHSD(). These include:
which : A character vector listing terms in the fitted model for which the intervals should be calculated. Defaults to all the terms.
ordered : A logical value indicating if the levels of the factor should be ordered according to increasing average in the sample before taking differences. If ordered is true then the calculated differences in the means will all be positive. The significant differences will be those for which the lwr end point is positive.
out: The format of outputs. If out = "long" a 'long' format (tibble) is returned. If out = "wide", a matrix with the adjusted p-values for each term is returned.
Returns
A tibble data frame containing the results of the pairwise comparisons (if out = "long") or a "list-columns" with p-values for each term (if out = "wide").
Examples
library(metan)mod <- lm(PH ~ GEN + REP, data = data_g)tukey_hsd(mod)tukey_hsd(mod, out ="wide")