library(reshape2) library(gplots) library(multcomp) DF = read.csv('../../Data/ASCII_Comma/Chapter_12/wormkiller.txt', quote='\'') DF_melt = melt(DF, id.vars=c(), variable.name='Group', value.name='Count') fit = aov(Count ~ Group, data=DF_melt) print(summary(fit)) #postscript("../../WriteUp/Graphics/Chapter12/prob_21_plotmeans.eps", onefile=FALSE, horizontal=FALSE) plotmeans(Count ~ Group, data=DF_melt) #dev.off() # A Tukey comparison of means test: # TukeyHSD(fit) par(las=2) par(mar=c(5, 8, 4, 2)) plot(TukeyHSD(fit)) # Use the multcomp package: # par(las=2) par(mar=c(5, 4, 6, 2)) tuk = glht(fit, linfct=mcp(Group='Tukey')) plot(cld(tuk, level=0.05), col='lightgrey') # A nonparametric test for one-way ANOVA: # print(kruskal.test(Count ~ Group, data=DF_melt))