Skip to contents

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)

Arguments

.data

The number of time units

Value

A time unit object for the Gregorian calendar system.

Details

The following Gregorian time units are available:

  • tu_year(): Year unit

  • tu_quarter(): Quarter (3-month period) unit

  • tu_month(): Month unit

  • tu_day(): Day unit

  • tu_hour(): Hour unit

  • tu_minute(): Minute unit

  • tu_second(): Second unit

  • tu_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)
)