Time unit constructors for the Gregorian calendar system. These units can be
used with linear_time() to create custom time representations.
Usage
tu_year(.data = 1L)
tu_quarter(.data = 1L)
tu_month(.data = 1L)
tu_day(.data = 1L)
tu_hour(.data = 1L)
tu_minute(.data = 1L)
tu_second(.data = 1L)
tu_millisecond(.data = 1L)Details
The following Gregorian time units are available:
tu_year(): Year unittu_quarter(): Quarter (3-month period) unittu_month(): Month unittu_day(): Day unittu_hour(): Hour unittu_minute(): Minute unittu_second(): Second unittu_millisecond(): Millisecond unit
These units form a hierarchy where conversions between adjacent units follow the Gregorian calendar rules. For units that don't have a fixed relationship (e.g., months to days), the conversion requires a time context.
See also
linear_time() for creating custom time representations,
linear_gregorian for pre-defined Gregorian time representations
Examples
# Create a custom time representation using Gregorian units
dayhour <- linear_time(
granules = list(tu_day(1L)),
chronon = tu_hour(1L)
)