I have a data that looks like this:
Sample data can be build using codes
df<-structure(list(ID = c(1, 1, 1, 2, 2, 3, 3, 3), Date = c("D