setwd("M:/web/17C - 2018/scripts")
library(tidyverse)
ecoli <- read.table("../data/ecoli.txt", header = T)
str(ecoli)
levels(ecoli$medium)
ecoli$Strain <- factor(ecoli$Strain)
str(ecoli)
summarySE(ecoli, measurevar = "dens", groupvars = c("Strain"))
summarySE(ecoli, measurevar = "dens", groupvars = c("medium"))
ecolisummary <- summarySE(ecoli, measurevar = "dens", groupvars = c("Strain", "medium"))
mod <- aov(data = ecoli, dens ~ Strain * medium) summary(mod)
interaction.plot(ecoli$Strain, ecoli$medium,ecoli$dens) interaction.plot(ecoli$medium, ecoli$Strain, ecoli$dens)
TukeyHSD(mod)
Strain:medium
ggplot(ecolisummary, aes(x = medium, y = dens, fill=Strain) ) +
geom_bar(stat="identity", colour="black",
position = position_dodge()) +
geom_errorbar(aes(ymin = dens - se, ymax = dens + se),
width = 0.4, position = position_dodge(0.9)) +
scale_fill_manual(values = c("#FFFFFF", "#CCCCCC", "#999999")) +
ylab("Optical density (units)") +
ylim(0, 30) +
xlab("Medium") +
theme(panel.background = element_rect(fill = "white"))+
theme(axis.line.x = element_line(color = "black"),
axis.line.y = element_line(color = "black")) +
# 2:GoCo-1:GoCo
annotate("segment", x = 3.7, xend = 3.95,
y = 20.5, yend = 20.5,
colour = "black") +
annotate("segment", x = 3.7, xend = 3.7,
y = 20.5, yend = 20,
colour = "black") +
annotate("segment", x = 3.95, xend = 3.95,
y = 20.5, yend = 20,
colour = "black") +
annotate("text", x = 3.85, y = 20.8,
label = "", size = 5) +
# 3:GoCo-2:GoCo
annotate("segment", x = 4.3, xend = 4.05,
y = 20.5, yend = 20.5,
colour = "black") +
annotate("segment", x = 4.3, xend = 4.3,
y = 20.5, yend = 20,
colour = "black") +
annotate("segment", x = 4.05, xend = 4.05,
y = 20.5, yend = 20,
colour = "black") +
annotate("text", x = 4.15, y = 20.8,
label = "", size = 5)+
# 1:GoCo-3:Colibroth
annotate("segment", x = 3.7, xend = 2.35,
y = 22.5, yend = 22.5,
colour = "black") +
annotate("segment", x = 2.35, xend = 2.35,
y = 22.5, yend = 22,
colour = "black") +
annotate("segment", x = 3.7, xend = 3.7,
y = 22.5, yend = 22,
colour = "black") +
annotate("text", x = 3, y = 22.8,
label = "", size = 5) +
# 2:GoCo-3:Colibroth
annotate("segment", x = 4, xend = 2.35,
y = 23.5, yend = 23.5,
colour = "black") +
annotate("segment", x = 2.35, xend = 2.35,
y = 23.5, yend = 23,
colour = "black") +
annotate("segment", x = 4, xend = 4,
y = 23.5, yend = 23,
colour = "black") +
annotate("text", x = 3.1, y = 23.8,
label = "", size = 5) +
# 3:Colibroth-2:Circle
annotate("segment", x = 1, xend = 2.25,
y = 22.5, yend = 22.5,
colour = "black") +
annotate("segment", x = 2.25, xend = 2.25,
y = 22.5, yend = 22,
colour = "black") +
annotate("segment", x = 1, xend = 1,
y = 22.5, yend = 22,
colour = "black") +
annotate("text", x = 1.6, y = 22.8,
label = "*", size = 5) +
# 3:Colibroth-1:Circle
annotate("segment", x = 0.7, xend = 2.25,
y = 23.5, yend = 23.5,
colour = "black") +
annotate("segment", x = 2.25, xend = 2.25,
y = 23.5, yend = 23,
colour = "black") +
annotate("segment", x = 0.7, xend = 0.7,
y = 23.5, yend = 23,
colour = "black") +
annotate("text", x = 1.5, y = 23.8,
label = "", size = 5)+
# 2:GoCo-1:Circle
annotate("segment", x = 0.7, xend = 4,
y = 24.5, yend = 24.5,
colour = "black") +
annotate("segment", x = 4, xend = 4,
y = 24.5, yend = 24,
colour = "black") +
annotate("segment", x = 0.7, xend = 0.7,
y = 24.5, yend = 24,
colour = "black") +
annotate("text", x = 2.4, y = 24.8,
label = "*", size = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.