granularity_names {calcal} | R Documentation |
Canonical granularities
Description
granularities()
will return a character vector of canonical granularity names for the
relevant calendar. These are the granularities used to define dates on the calendar.
granularity()
will return a vector of numerical values for a given canonical granularity.
Usage
granularity_names(calendar)
granularity(date, granularity)
Arguments
calendar |
A calcal object defining a calendar. |
date |
A date vector on some calendar |
granularity |
A character string indicating the granularity to extract |
Value
A character vector of granularity names or a vector of numerical values for the specified granularity.
See Also
week_of_year for some non-canonical granularities.
Examples
granularity_names(cal_iso)
granularity_names(cal_gregorian)
date_iso <- new_date(year = 2025, week = 23, day = 2, calendar = cal_iso)
granularity(date_iso, "week")
date_gregorian <- new_date(year = 2025, month = 1, day = 1, calendar = cal_gregorian)
granularity(date_gregorian, "month")
[Package calcal version 1.0.0 Index]