duration() creates a vector of durations with a specified chronon.
Durations represent a fixed span of time measured in a given time granule
(e.g., 3 months, 5 days), without reference to a specific point in time.
Usage
duration(data, chronon = time_chronon(data), calendar = time_calendar(data))Arguments
- data
A time vector of duration magnitudes.
- chronon
A time granule expression representing the chronon, evaluated in the context of
calendar. Use unquoted expressions likemonth(1L)orday(1L). Chronons from a specific calendar can also be used (e.g.cal_gregorian$month(1L)). Defaults to the time chronon of the inputdata(time_chronon(data)).- calendar
Calendar system used to evaluate
chronon. Defaults totime_calendar(data)for existing time objects. Common options include cal_gregorian and cal_isoweek.
See also
new_duration_fn()for creating reusable duration functionscal_gregorian, cal_isoweek for calendar systems