Skip to contents

mixtime (development version)

This is the initial CRAN release of the package with provides the core data types and temporal manipulation for temporal analysis with mixed granularity data.

New features

Time

  • The generic mixtime() constructor for creating mixed temporal vectors that combine time points of different granularities (e.g. monthly and quarterly) in a single vector via vecvec.

Linear time

Cyclical time

Calendar systems

  • Three initial calendar systems:
    • cal_gregorian: standard Gregorian calendar with year, quarter, month, day, hour, minute, second, and millisecond units.
    • cal_isoweek: ISO 8601 week-date calendar with ISO year, week, and day units. Weeks always start on Monday; the first week of the year is the week containing the first Thursday.
    • cal_sym454: Symmetry454 perennial solar calendar with a symmetrical 4–5–4 week pattern per quarter and a leap-week rule.

Sequences

  • seq() methods for mixtime and mt_time objects support integer, string (e.g. "1 month"), and time unit by arguments, as well as length.out and along.with. Overflow behaviour when step units differ from sequence units can be controlled with on_invalid = "nearest" (default) or "overflow".

Rounding

Formatting

  • A mixed-calendar general purpose formatting system is provided for mixtime objects. The format strings use glue-like {} substitutions with the helper functions lin(x) and cyc(x, y) to position linear and cyclical time components in a string. x and y are time units from a calendar, which can be used to create general purpose mixed-calendar time formats.

Timezone support

  • tz_name() extracts the timezone from a time object.
  • tz_offset() returns the UTC offset for a datetime in its timezone.
  • tz_abbreviation() returns the timezone abbreviation (e.g. "EST", "PDT").
  • tz_transitions() returns a data frame of DST and other timezone transitions between two time points.

Accessor functions

tsibble and fable compatibility

  • Methods for tsibble index validation are provided, enabling mixtime vectors to be used as time indexes in tsibble objects and in forecasting with fable.

Extensibility

Vignettes

  • Extending mixtime - a vignette on how to define new calendars and implement calendar arithmetic for temporal operations within the calendar’s units and with other calendars.