year_day {clock} | R Documentation |
year_day()
constructs a calendar vector from the Gregorian
year and day of the year.
year_day( year, day = NULL, hour = NULL, minute = NULL, second = NULL, subsecond = NULL, ..., subsecond_precision = NULL )
year |
The year. Values |
day |
The day of the year. Values |
hour |
The hour. Values |
minute |
The minute. Values |
second |
The second. Values |
subsecond |
The subsecond. If specified, If using milliseconds, values If using microseconds, values If using nanoseconds, values |
... |
These dots are for future extensions and must be empty. |
subsecond_precision |
The precision to interpret |
Fields are recycled against each other.
Fields are collected in order until the first NULL
field is located. No
fields after the first NULL
field are used.
A year-day calendar vector.
# Just the year x <- year_day(2019:2025) x year_day(2020, 1:10) # Last day of the year, accounting for leap years year_day(2019:2021, "last") # Precision can go all the way out to nanosecond year_day(2019, 100, 2, 40, 45, 200, subsecond_precision = "nanosecond")