© 2018 Aaron A. King.
Load the data from Vandermeer’s Paramecium experiments.
library(readr)
library(ggplot2)
library(magrittr)
library(reshape2)
library(plyr)
library(dplyr)
read_csv("https://kinglab.eeb.lsa.umich.edu/202/vandy/vandy_data.csv",
comment="#") -> dat
unique(dat$species)
## [1] "Bl" "Pa" "Pb" "Pc"
unique(dat$experiment)
## [1] "Bl" "BlPa" "BlPaPbPc" "BlPb" "BlPc" "Pa"
## [7] "PaPb" "PaPc" "Pb" "PbPc" "Pc"
unique(dat$rep)
## [1] 1 2 3 4 5 6 7 8
Select out the two-species experiments:
dat %>%
subset(
experiment %in% c("BlPa","BlPb","BlPc","PaPb","PaPc","PbPc"),
select=-food) -> dat
dat
dat %>%
ddply(~rep,mutate,prev=lag(count,1)) %>%
ggplot(aes(x=day,y=count,group=species,color=species))+
geom_line()+
facet_grid(experiment~rep,labeller=labeller(rep=label_both),scales="free")+
scale_y_log10()+
theme_bw()