Question 1

library("ggplot2")
library("reshape2")
library("stringi")
data=data <- read.csv("exp.csv")
data$line = stri_sub(data$Well, 1, 1)
data$column = strtoi(stri_sub(data$Well, 2, -1))
dat = subset(data, line=='A')
dat = subset(dat, column=='12')
p <- ggplot(data = data, aes(x = Cycle)) + geom_line(aes(y=JOE, colour="JOE")) + geom_line(aes(y=FAM,colour="FAM")) + facet_grid(line ~ column) + scale_colour_manual("Entity", values=c("blue", "red"))
p

Question 2

p <- ggplot(data = data, aes(x = FAM)) + geom_point(aes(y=JOE, colour=Cycle), size=0.1) + facet_grid(line ~ column) + scale_colour_gradientn(colours=rainbow(7))
p

Question 3

We can see that on most trajectories, JOE increases at the beginning, then FAM increases while JOE decreases, and finally FAM decreases (then it loops), which means that JOE is the prey and FAM is the predator (the preys are increasing, then the predators increase by eating the preys, and the predators decrease due to a lack of prey).

Question 4 (incomplete)

mapping_exo <- function(n) {
  if (n==1 || n==7) {
    return(0.5)
  } else if (n==2 || n==8) {
    return(1)
  } else if (n==3 || n==9) {
    return(2)
  } else if (n==4 || n==10) {
    return(3)
  } else if (n==5 || n==11) {
    return(4)
  } else if (n==6 || n==12) {
    return(0.5)
  } else
    return(-1)
}
data$exo = lapply(data$column, mapping_exo)
data