I am working on a project for one of my classes and cannot figure out how to obtain the letters for treatment comparisons after using the tukeyHSD post-hoc test.
Is there a simple way to do this?
Here is my code:
Boulder study
rm(list=ls())
getwd()
setwd('/Volumes/9163980664/GIS/Boulder_Field/CSV_files')
list.files()
bodega <- read.table('biotic_stats.csv', sep=',', h=T)
head(bodega[,1:5])
length(bodega$Face[bodega$Face=='E'])
length(bodega$Face[bodega$Face=='N'])
length(bodega$Face[bodega$Face=='S'])
length(bodega$Face[bodega$Face=='W'])
One way ANOVA
boulder_face <- bodega$Face
proportion_rockweed <- bodega$Pelvetiopsis_prop_cover_
Barplot
setwd('/Volumes/9163980664/GIS/Boulder_Field/R_code_graphs_stats')
ylab = 'Rockweed Proportion'
xlab = 'Face of Boulder'
graphics.off(); quartz(width=4, height=4); par(mai=c(1.2,1.2,.3,.5), cex=1.4)
plot(proportion_rockweed ~ boulder_face, data=bodega, col="grey", ylab=ylab, xlab=xlab)
dev.print(png, file = "Bodega_Rockweed_boxplot.png", wid = 480, height = 480)
ANOVA
bodega.anova <- aov(proportion_rockweed ~ boulder_face, data = bodega)
summary(bodega.anova)
TukeyHSD(bodega.anova)
help(aov)
here is what i have tried
TukeyHSD(bodega.anova)
quartz(width=4, height=4); par(mai=c(1.2,1.2,1,1), cex=1)
plot(TukeyHSD(bodega.aov))
bodega.anova <- aov(proportion_rockweed ~ boulder_face, data = bodega)
library(multcompView)
multcompLetters(extract_p(TukeyHSD(bodega.anova)))
I just saw this. You can use the lsmeans package and get them easily
library(lsmeans)
cld(bodega.anova, "boulder_face")
This requires that the multcompView package be installed. The Tukey method is the default, but you can specify other adjustments using an adjust
argument.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.