is_time: Check the time type of values

is_timeR Documentation

Check the time type of values

Description

Test whether elements of a mixtime vector are linear, cyclical, underspecified cyclical, or durations.

Usage

time_is_linear(x, ...)

time_is_cyclical(x, ...)

time_is_cyclical_free(x, ...)

time_is_duration(x, ...)

Arguments

x

A time object (typically a mixtime vector).

...

Additional arguments for methods.

Details

These helpers return a logical vector the same length as x identifying the type of time represented by each element. time_is_cyclical() and time_is_cyclical_free() are distinct: located cyclical time (e.g. month_of_year() of a real date) knows its enclosing cycle (which year), while underspecified cyclical time (e.g. bare month_of_year(3)) doesn't. See cyclical_time() for the differences.

Value

A logical vector the same length as x.

Examples

t <- c(yearmonth(0), month_of_year(as.Date("2020-01-01")), months(0L))
time_is_linear(t)
time_is_cyclical(t)
time_is_duration(t)

time_is_cyclical_free(month_of_year(3))


mixtime documentation built on Nov. 18, 2026, 5:08 p.m.