Cuckoos1 <- read.table("c:/temp/cuckoos2.dat",header=T) names(Cuckoos1) Cuckoos1$Species <- as.factor(Cuckoos1$Species) # to make sure that Species is a factor, not numeric boxplot(Length ~ Species, data=Cuckoos1,main="Cuckoo data") anova(lm(Length ~ Species, data=Cuckoos1)) windows() par(mfrow=c(2,2)) plot(lm(Length ~ Species, data=Cuckoos1)) par(mfrow=c(1,1)) # these expressions calculate the sum of squares for a contrast ' Pipits vs Robins' contrast1 <- c(0,1,0,-2,1,0) l1hat <- contrast1 %*% tapply(Cuckoos1$Length,Cuckoos1$Species,mean) denoml1hat <- contrast1^2 / tapply(Cuckoos1$Length,Cuckoos1$Species,length) ssl1hat <- l1hat^2 / sum(denoml1hat) # Tukey multiple comparisons TukeyHSD(aov(Length ~ Species, data=Cuckoos1),"Species" ) plot(TukeyHSD(aov(Length ~ Species, data=Cuckoos1),"Species" ))