powered by
date_group() groups by a single component of a date-time, such as month of the year, or day of the month.
date_group()
There are separate help pages for grouping dates and date-times:
dates (Date)
date-times (POSIXct/POSIXlt)
date_group(x, precision, ..., n = 1L)
x, grouped at precision.
x
precision
[Date / POSIXct / POSIXlt]
A date or date-time vector.
[character(1)]
A precision. Allowed precisions are dependent on the input used.
These dots are for future extensions and must be empty.
[positive integer(1)]
A single positive integer specifying a multiple of precision to use.
# See type specific documentation for more examples date_group(as.Date("2019-01-01") + 0:5, "day", n = 2)
Run the code above in your browser using DataLab