accessors {fastymd} | R Documentation |
Generics for accessing the year, month and month-day of an object
Description
Fast methods are provided for Date
objects. The underlying algorithm
follows the approach described in Hinnant (2021) for converting days since
the UNIX Epoch to Gregorian Calendar dates.
Usage
get_ymd(x, ...)
get_year(x, ...)
get_month(x, ...)
get_mday(x, ...)
Arguments
x |
An R object. |
... |
Further arguments passed to or from other methods. |
Value
For get_ymd()
a data frame with integer columns year, month and mday. For
get_year()
, get_month()
and get_mday()
, integer vectors of the
requested components.
References
Hinnant, J. (2021) chrono-Compatible Low-Level Date Algorithms. Available at: https://howardhinnant.github.io/date_algorithms.html#civil_from_days (Accessed 17 April 2025).
Examples
date <- as.Date("2025-04-17")
get_ymd(date)
get_year(date)
get_month(date)
get_mday(date)
[Package fastymd version 0.1.3 Index]