year-week-day-getters {clock} | R Documentation |
Getters: year-week-day
Description
These are year-week-day methods for the getter generics.
-
get_year()
returns the year. Note that this can differ from the Gregorian year. -
get_week()
returns the week of the current year. -
get_day()
returns a value between 1-7 indicating the weekday of the current week, where1 = start of week
and7 = end of week
, in line with the chosenstart
. There are sub-daily getters for extracting more precise components.
Usage
## S3 method for class 'clock_year_week_day'
get_year(x)
## S3 method for class 'clock_year_week_day'
get_week(x)
## S3 method for class 'clock_year_week_day'
get_day(x)
## S3 method for class 'clock_year_week_day'
get_hour(x)
## S3 method for class 'clock_year_week_day'
get_minute(x)
## S3 method for class 'clock_year_week_day'
get_second(x)
## S3 method for class 'clock_year_week_day'
get_millisecond(x)
## S3 method for class 'clock_year_week_day'
get_microsecond(x)
## S3 method for class 'clock_year_week_day'
get_nanosecond(x)
Arguments
x |
A year-week-day to get the component from. |
Value
The component.
Examples
x <- year_week_day(2019, 50:52, 1:3)
x
# Get the week
get_week(x)
# Gets the weekday
get_day(x)
# Note that the year can differ from the Gregorian year
iso <- year_week_day(2019, 1, 1, start = clock_weekdays$monday)
ymd <- as_year_month_day(iso)
get_year(iso)
get_year(ymd)
[Package clock version 0.7.1 Index]