year-week-day-setters | R Documentation |
These are year-week-day methods for the setter generics.
set_year()
sets the year.
set_week()
sets the week of the year. Valid values are in the range
of [1, 53]
.
set_day()
sets the day of the week. Valid values are in the range of
[1, 7]
.
There are sub-daily setters for setting more precise components.
## S3 method for class 'clock_year_week_day'
set_year(x, value, ...)
## S3 method for class 'clock_year_week_day'
set_week(x, value, ...)
## S3 method for class 'clock_year_week_day'
set_day(x, value, ...)
## S3 method for class 'clock_year_week_day'
set_hour(x, value, ...)
## S3 method for class 'clock_year_week_day'
set_minute(x, value, ...)
## S3 method for class 'clock_year_week_day'
set_second(x, value, ...)
## S3 method for class 'clock_year_week_day'
set_millisecond(x, value, ...)
## S3 method for class 'clock_year_week_day'
set_microsecond(x, value, ...)
## S3 method for class 'clock_year_week_day'
set_nanosecond(x, value, ...)
x |
A year-week-day vector. |
value |
The value to set the component to. For |
... |
These dots are for future extensions and must be empty. |
x
with the component set.
# Year precision vector
x <- year_week_day(2019:2023)
# Promote to week precision by setting the week
# (Note that some weeks have 52 weeks, and others have 53)
x <- set_week(x, "last")
x
# Set to an invalid week
invalid <- set_week(x, 53)
invalid
# Here are the invalid ones (they only have 52 weeks)
invalid[invalid_detect(invalid)]
# Resolve the invalid dates by choosing the previous/next valid moment
invalid_resolve(invalid, invalid = "previous")
invalid_resolve(invalid, invalid = "next")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.