I have a dataframe like this:
vec <- LETTERS[1 : 4]
id <- rep(vec, each = 16)
date <- seq(as.Date("2021-01-01"), as.Date("2021-03-05"), by = "days")
data <- cbind.data.frame(id, date)
I want to create a new column, "section", which has a unique identifying value for every 14 days. I know I need to use dplyr to group_by id, because each ID has its own unique starting date and I want the first two weeks (and so on) of A to be labeled as the same "section" as the first two weeks (and so on) of B, C, and D.
Edit: Some of the dates in my real dataset skip days, so I cannot rely on counting by row.
Thanks in advance.