warp.lm <- lm(breaks ~ wool * tension, data = warpbreaks)
warp.rg <- ref_grid(warp.lm)
# Do all pairwise comparisons within rows or within columns,
# all considered as one faily of tests:
w.t <- pairs(emmeans(warp.rg, ~ wool | tension))
t.w <- pairs(emmeans(warp.rg, ~ tension | wool))
rbind(w.t, t.w, adjust = "mvt")
update(w.t + t.w, adjust = "fdr") ## same as above except for adjustment
# Show only 3 of the 6 cases
summary(warp.rg[c(2, 4, 5)])
# After-the-fact 'at' specification
subset(warp.rg, wool == "A") ## or warp.rg |> subset(wool == "A")
### Working with 'emm_list' objects
mod <- lm(conc ~ source + factor(percent), data = pigs)
all <- emmeans(mod, list(src = pairwise ~ source, pct = consec ~ percent))
rbind(all, which = c(2, 4), adjust = "mvt")
### Irregular object
tmp <- warp.rg[-1]
## emmeans(tmp, "tension") # will fail because tmp is irregular
emmeans(force_regular(tmp), "tension") # will show some results
Run the code above in your browser using DataLab