| new_duration_fn | R Documentation |
new_duration_fn() creates a duration function for a specified chronon. A
chronon is the smallest indivisible time unit (e.g., days, months) that
defines what the numeric magnitudes in the resulting duration vector
represent.
new_duration_fn(chronon, default_calendar = cal_gregorian)
chronon |
A bare call for a time unit object representing the chronon
(e.g., |
default_calendar |
A default calendar used to resolve the time units
if they don't exist in the calendar of the input data (e.g.,
|
A function used to create duration vectors with a specific chronon. The returned function accepts:
dataA numeric vector of duration magnitudes.
calendarA calendar system used to evaluate chronon. Defaults
to time_calendar(data).
...Additional arguments passed to the chronon (e.g., tz for
timezones).
duration() for creating duration vectors directly
cal_gregorian, cal_isoweek for calendar systems
# Create a months duration function
months <- new_duration_fn(month(1L), default_calendar = cal_gregorian)
months(1:6)
# Create a days duration function
days <- new_duration_fn(day(1L), default_calendar = cal_gregorian)
days(1:7)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.