Trying to calculate retention rate in R, how to divide one row by another with the same date and then apply same logic across entire data frame? : <p>I am attempting to calculate retention rate of an Instagram story (# of viewers on the last frame divided by # viewers on first frame) within the same date. I have this data within a data frame in R where each frame is listed as a a row and any frame with the same date makes up the entire story for that date. I am having a hard time figuring out how to obtain the index of the first and last frame within the same date and then dividing them and then applying this to the rest of the data frame? Any help would be greatly appreciated!</p>
