I'm having trouble generating a compact letter display for my results. I've run an ANOVA followed by Tukey's HSD to generate the p values for each pair, but I do not know how (or if it is possible?) to assign letters to these p values to show which pairs are significant from each other.
csa.anova<-aov(rate~temp*light,data=csa.per.chl)
summary(csa.anova)
TukeyHSD(csa.anova)
This runs the tests I need, but I don't know how to assign letters to each p value to show which pairs are significant.
You need to install the multcomp
package first. It can compute the Tukey HSD Test and returns an object that has summary
and plot
methods. The package also has a function (cld
) to print the "compact letter display." As an example we can use the iris data set that comes with R:
library(multcomp)
data(iris)
iris.aov <- aov(Petal.Length~Species, iris)
iris.tukey <- glht(iris.aov, linfct=mcp(Species="Tukey"))
cld(iris.tukey)
# setosa versicolor virginica
# "a" "b" "c"