biom <- read.table("../data/biomass.txt", header = T)
str(biom)
biom <- gather(biom, key = spray, value = biomass)
ggplot(data = biom, aes(x = spray, y = biomass)) + geom_boxplot()
biomsum <- biom %>% group_by(spray) %>% summarise(mean = mean(biomass), median = median(biomass), sd = sd(biomass), n = length(biomass), se = sd / sqrt(n))
model <- aov(data = biom, biomass ~ spray) summary(model)
TukeyHSD(model, ordered = T) plot(TukeyHSD(model, ordered = T), cex.axis = 0.5)
arrange(biomsum, mean)
ggplot() +
geom_point(data = biom, aes(x = reorder(spray, biomass), y = biomass),
position = position_jitter(width = 0.1, height = 0),
colour = "gray50") +
geom_errorbar(data = biomsum,
aes(x = spray, ymin = mean - se, ymax = mean + se),
width = 0.3) +
geom_errorbar(data = biomsum,
aes(x = spray, ymin = mean, ymax = mean),
width = 0.2) +
ylim(0, 520) +
ylab("Pest Biomass (units)") +
xlab("Spray treatment") +
# E and control are one group
annotate("segment", x = 4.5, xend = 6.5,
y = 397, yend = 397,
colour = "black", size = 1) +
annotate("text", x = 5.5, y = 385,
label = "N.S", size = 4) +
# WaterControl-D and E-D
annotate("segment", x = 4, xend = 5.5,
y = 410, yend = 410,
colour = "black") +
annotate("segment", x = 4, xend = 4,
y = 410, yend = 400,
colour = "black") +
annotate("segment", x = 5.5, xend = 5.5,
y = 410, yend = 400,
colour = "black") +
annotate("text", x = 4.5, y = 420,
label = "", size = 5) +
# WaterControl-B
annotate("segment", x = 3, xend = 5.5,
y = 440, yend = 440,
colour = "black") +
annotate("segment", x = 3, xend = 3,
y = 440, yend = 430,
colour = "black") +
annotate("segment", x = 5.5, xend = 5.5,
y = 440, yend = 430,
colour = "black") +
annotate("text", x = 4, y = 450,
label = "", size = 5) +
# WaterControl-C
annotate("segment", x = 2, xend = 5.5,
y = 475, yend = 475,
colour = "black") +
annotate("segment", x = 2, xend = 2,
y = 475, yend = 465,
colour = "black") +
annotate("segment", x = 5.5, xend = 5.5,
y = 475, yend = 465,
colour = "black") +
annotate("text", x = 3.5, y = 485,
label = "", size = 5) +
# WaterControl-A
annotate("segment", x = 1, xend = 5.5,
y = 510, yend = 510,
colour = "black") +
annotate("segment", x = 1, xend = 1,
y = 510, yend = 500,
colour = "black") +
annotate("segment", x = 5.5, xend = 5.5,
y = 510, yend = 500,
colour = "black") +
annotate("text", x = 3.5, y = 520,
label = "", size = 5) +
# A-D **
annotate("segment", x = 1, xend = 4,
y = 330, yend = 330,
colour = "black") +
annotate("segment", x = 1, xend = 1,
y = 330, yend = 320,
colour = "black") +
annotate("segment", x = 4, xend = 4,
y = 330, yend = 320,
colour = "black") +
annotate("text", x = 2.5, y = 335,
label = "", size = 5) +
theme_classic()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.