This is an iso-year-week-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
.
Usage
# S3 method for clock_iso_year_week_day
calendar_start(x, precision)
# S3 method for clock_iso_year_week_day
calendar_end(x, precision)
Arguments
- x
[clock_iso_year_week_day]
A iso-year-week-day vector.
- precision
[character(1)]
One of:
"year"
"week"
"day"
"hour"
"minute"
"second"
"millisecond"
"microsecond"
"nanosecond"
Examples
x <- iso_year_week_day(2019:2020, 5, 6, 10)
x
#> <iso_year_week_day<hour>[2]>
#> [1] "2019-W05-6T10" "2020-W05-6T10"
# Compute the last moment of the last iso week of the year
calendar_end(x, "year")
#> <iso_year_week_day<hour>[2]>
#> [1] "2019-W52-7T23" "2020-W53-7T23"
# Compare that to just setting the week to `"last"`,
# which doesn't affect the other components
set_week(x, "last")
#> <iso_year_week_day<hour>[2]>
#> [1] "2019-W52-6T10" "2020-W53-6T10"