# NOT RUN {
if(require(multcomp)) { # --- multcomp must be installed
warp.lm <- lm(breaks ~ wool*tension, data = warpbreaks)
# Using 'emm'
summary(glht(warp.lm, emm(pairwise ~ tension | wool)))
# Same, but using an existing 'emmeans' result
warp.emm <- emmeans(warp.lm, ~ tension | wool)
summary(as.glht(pairs(warp.emm)))
# Same contrasts, but treat as one family
summary(as.glht(pairs(warp.emm), by = NULL))
} # --- was tested only if multcomp is installed
# }
Run the code above in your browser using DataLab