I have the following data frame
x <- data.frame("treatment"= c(1, 1, 1, 1, 2, 2, 2, 2),
"Time" = c(0, 30, 60, 180, 0, 30, 60, 180),
"cells_alive" = c(500, 470, 100, 20, 476, 310, 99, 2))
In this experiment I have two treatments, where I measure the number of alive cells over time. The number of cells at time 0 is the initial number of cells for that treatment. I need to calculate the percentage of cells alive at each time in a new column. So in the case of treatment 1 it would be 500/500, 470/500, 100/500 and so on. Any ideas of how to calculate this?
Thanks