date_group: Group date and date-time components

Description Usage Arguments Value Examples

View source: R/date.R

Description

date_group() groups by a single component of a date-time, such as month of the year, or day of the month.

There are separate help pages for grouping dates and date-times:

Usage

1
date_group(x, precision, ..., n = 1L)

Arguments

x

[Date / POSIXct / POSIXlt]

A date or date-time vector.

precision

[character(1)]

A precision. Allowed precisions are dependent on the input used.

...

These dots are for future extensions and must be empty.

n

[positive integer(1)]

A single positive integer specifying a multiple of precision to use.

Value

x, grouped at precision.

Examples

1
2
# See type specific documentation for more examples
date_group(as.Date("2019-01-01") + 0:5, "day", n = 2)

clock documentation built on July 23, 2021, 1:06 a.m.