# NOT RUN {
warp.lm <- lm(breaks ~ wool*tension, data = warpbreaks)
warp.emmGrid <- emmeans(warp.lm, ~ tension | wool)
contrast(warp.emmGrid, "poly") # inherits 'by = "wool"' from warp.emmGrid
pairs(warp.emmGrid) # ditto
contrast(warp.emmGrid, "eff", by = NULL) # contrasts of the 6 factor combs
# An interaction contrast for tension:wool
tw.emmGrid <- contrast(warp.emmGrid, interaction = c("poly", "consec"), by = NULL)
tw.emmGrid # see the estimates
coef(tw.emmGrid) # see the contrast coefficients
# }
Run the code above in your browser using DataLab