I have a timelapse dataset with the columns time, valueand condition[and a few others] and want to calculate the log fold change1 for each condition.
Is there a nice, "r"-way to do this?
MWE below:
time <- c(1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8) value <- c(2,4,8,16,32,64,120,250,4,8,16,32,64,120,250,500,3,9,27,81,243,729,2187,6561) condition1 <- c("A", "A", "A", "A","A", "A", "A", "A","B","B","B","B","B","B","B","B","C","C","C","C","C","C","C","C")
d <- data.frame(time = time, value = value, condition1 = condition1)
ggplot(data = d) + geom_line(aes(x = time, y = value, color = condition1))
1: For each condition, for each time point t I want to calculate log(t[x] / t[1])