[R] TukeyHSDs function (pgirmess package)

Peter Ehlers ehlers at math.ucalgary.ca
Mon Apr 10 21:36:29 CEST 2006


Rune Vejen Petersen wrote:

> Dear R-help,
>  
> I have been trying to use the TukeyHSDs function in the "pgirmess"
> package to quickly extract all
> significant pairwise comparisons in an aov object. However, it seems
> that this function isn't working
> as intended when only the two last populations means being tested are
> significant.
>  
> An example of this can be seen below:
>  
> 
>>numbers<-c(464,482,453,434,495,487) 
>>group<-gl(3,2,label=c("A","B","C"))
>>testobject<-aov(numbers~group)
>>result<-TukeyHSD(testobject,conf.level=0.95)
>>error<-TukeyHSDs(result)
>>error$group[,1]
> 
> Error in error$group[, 1] : incorrect number of dimensions
>  
> To illustrate the "normal" function, the data set below can be used.
>  
> 
>>numbers<-c(845,829,682, 689,581,495)
> 
>  
> Is there something wrong with this function? Or is there a better way
> to extract significant comparisons
> from a tukey test?

It looks like the line

   res[[1]] <- x[y, ]

in TukeyHSDs() should be replaced with

   res[[1]] <- x[y, , drop = FALSE]


Peter Ehlers

>  
> Cheers,
> Rune
> -------------------------------------------
> Rune Vejen Petersen, M.Sc.Eng.
> Statens Serum Institute
> Dept. of Infectious Disease Immunology
> Artillerivej 5, 81/344
> DK-2300 Copenhagen
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list