year-day-setters | R Documentation |
These are year-day methods for the setter generics.
set_year()
sets the Gregorian year.
set_day()
sets the day of the year. Valid values are in the range
of [1, 366]
.
There are sub-daily setters for setting more precise components.
## S3 method for class 'clock_year_day'
set_year(x, value, ...)
## S3 method for class 'clock_year_day'
set_day(x, value, ...)
## S3 method for class 'clock_year_day'
set_hour(x, value, ...)
## S3 method for class 'clock_year_day'
set_minute(x, value, ...)
## S3 method for class 'clock_year_day'
set_second(x, value, ...)
## S3 method for class 'clock_year_day'
set_millisecond(x, value, ...)
## S3 method for class 'clock_year_day'
set_microsecond(x, value, ...)
## S3 method for class 'clock_year_day'
set_nanosecond(x, value, ...)
x |
A year-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.
x <- year_day(2019)
# Set the day
set_day(x, 12:14)
# Set to the "last" day of the year
set_day(x, "last")
# Set to an invalid day of the year
invalid <- set_day(x, 366)
invalid
# Then resolve the invalid day by choosing the next valid day
invalid_resolve(invalid, invalid = "next")
# Cannot set a component two levels more precise than where you currently are
try(set_hour(x, 5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.