here is an example of my data:
m <- data.frame(swim = c(0,1,0,0), time1 = c(1,2,3,4), time2 = c(2,3,4,5))
I want to replace all numbers in columns time1 and time2 with NA
after the row where there is a 1
in m$swim
. It should look like this:
n <- data.frame(swim = c(0,1,0,0), time1 = c(1,2,NA,NA), time2 = c(2,3,NA,NA))
Thank you!