Exploratory Community

How to round Date column into 3-day intervals

#1

To round Date column into 3-day intervals, you can make the date to integer first, and round it into intervals of 3, and then convert it back to Date.

The expression for mutate becomes like this.

ymd("1970-01-01") + days(as.integer(Date - ymd("1970-01-01")) %/% 3 * 3)

Screenshot of how this works: