[R] TukeyHSD output

David L Carlson dcarlson at tamu.edu
Fri Aug 24 05:32:24 CEST 2012


Your best bet is to use package multcomp:

set.seed(42)
A <- rnorm(25, 6, 2)
B <- rnorm(25, 7, 2)
C <- rnorm(25, 7.5, 2)
D <- rnorm(25, 8, 2)
Example <- rbind(data.frame(grp="A", X=A), data.frame(grp="B", X=B), 
     data.frame(grp="C", X=C), data.frame(grp="D", X=D))

require(multcomp)
Anova.Ex <- aov(X~grp, data=Example)
summary(Anova.Ex)
# (g)eneral (l)inear (h)ypothesis (t)esting
Pairs.Ex <- glht(Anova.Ex, linfct=mcp(grp="Tukey")) 
summary(Pairs.Ex)
confint(Pairs.Ex) # Confidence intervals
cld(Pairs.Ex)     # (c)ompact (l)etter (d)isplay
plot(confint(Pairs.Ex)) 

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352



> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Jinsong Zhao
> Sent: Thursday, August 23, 2012 9:40 PM
> To: r-help at r-project.org
> Subject: Re: [R] TukeyHSD output
> 
> On 2012-08-24 8:58, David Douterlungne wrote:
> > Hi all,
> >
> > Is there a R-function that orders Tukey results with conveniant
> letters, similar to the SPSS output (A, AB, ABC, C, etc.) .
> >
> 
> library(multcompView)
> ?multcompLetters
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list