My data frame looks like this
value <- c(0,0.1,0.2,0.4,0,0.05,0.05,0.5,0.20,0.40,0.50,0.60) time <- c(1,1,1,1,2,2,2,2,3,3,3,3) ID <- c(1,2,3,4,1,2,3,4,1,