year-quarter-day-group {clock}R Documentation

Grouping: year-quarter-day

Description

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

Grouping for a year-quarter-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_quarter_day'
calendar_group(x, precision, ..., n = 1L)

Arguments

x

⁠[clock_year_quarter_day]⁠

A year-quarter-day vector.

precision

⁠[character(1)]⁠

One of:

  • "year"

  • "quarter"

  • "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_quarter_day(2019, 1:4)
x <- c(x, set_year(x, 2020))

# Group by 3 quarters
# Note that this is a grouping of 3 quarters of the current year
# (i.e. the count resets at the beginning of the next year)
calendar_group(x, "quarter", n = 3)

# Group by 5 days of the current quarter
y <- year_quarter_day(2019, 1, 1:90)
calendar_group(y, "day", n = 5)

[Package clock version 0.7.0 Index]