if (FALSE) {
ds <- loadDataset("example")
ds$month_cat <- cut(ds$date, breaks = "month", name = "monthly")
ds$four_weeks_cat <- cut(ds$date, breaks = "4 weeks", name = "four week categorical date")
ds$wave_cat <- cut(
ds$date,
as.Date(c("2020-01-01", "2020-02-15", "2020-04-01", "2020-05-15")),
labels = c("wave1", "wave2", "wave3"),
name = "wave var"
)
}
Run the code above in your browser using DataLab