x <- as.Date("2019-01-01") + -3:5
x
# Group by 2 days of the current month.
# Note that this resets at the beginning of the month, creating day groups
# of [29, 30] [31] [01, 02] [03, 04].
date_group(x, "day", n = 2)
# Group by month
date_group(x, "month")
Run the code above in your browser using DataLab