year-week-day-group: Grouping: year-week-day

year-week-day-groupR Documentation

Grouping: year-week-day

Description

This is a year-week-day method for the calendar_group() generic.

Grouping for a year-week-day object can be done at any precision, as long as x is at least as precise as precision.

Usage

## S3 method for class 'clock_year_week_day'
calendar_group(x, precision, ..., n = 1L)

Arguments

x

⁠[clock_year_week_day]⁠

A year-week-day vector.

precision

⁠[character(1)]⁠

One of:

  • "year"

  • "week"

  • "day"

  • "hour"

  • "minute"

  • "second"

  • "millisecond"

  • "microsecond"

  • "nanosecond"

...

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 the specified precision.

Examples

x <- year_week_day(2019, 1:52)

# Group by 3 weeks
calendar_group(x, "week", n = 3)

y <- year_week_day(2000:2020, 1, 1)

# Group by 2 years
calendar_group(y, "year", n = 2)

clock documentation built on Sept. 11, 2024, 8:39 p.m.