This is a year-day method for the calendar_start() and calendar_end() generics. They adjust components of a calendar to the start or end of a specified precision.

# S3 method for clock_year_day
calendar_start(x, precision)

# S3 method for clock_year_day
calendar_end(x, precision)

Arguments

x

[clock_year_day]

A year-day vector.

precision

[character(1)]

One of:

  • "year"

  • "day"

  • "hour"

  • "minute"

  • "second"

  • "millisecond"

  • "microsecond"

  • "nanosecond"

Value

x at the same precision, but with some components altered to be at the boundary value.

Examples

# Day precision x <- year_day(2019:2020, 5) x
#> <year_day<day>[2]> #> [1] "2019-005" "2020-005"
# Compute the last day of the year calendar_end(x, "year")
#> <year_day<day>[2]> #> [1] "2019-365" "2020-366"