year_day {clock} | R Documentation |
Calendar: year-day
Description
year_day()
constructs a calendar vector from the Gregorian
year and day of the year.
Usage
year_day(
year,
day = NULL,
hour = NULL,
minute = NULL,
second = NULL,
subsecond = NULL,
...,
subsecond_precision = NULL
)
Arguments
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 |
Details
Fields are recycled against each other using tidyverse recycling rules.
Fields are collected in order until the first NULL
field is located. No
fields after the first NULL
field are used.
Value
A year-day calendar vector.
Examples
# 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")