as_mixtime: Convert a time class into a mixtime

View source: R/coerce.R

as_mixtimeR Documentation

Convert a time class into a mixtime

Description

Coerces a time object (e.g. Date, POSIXct, yearmonth) to a mixtime vector using vctrs::vec_cast(). The chronon and cycle are inferred from x via time_chronon() and time_cycle().

Usage

as_mixtime(x, ...)

Arguments

x

A time value to convert to a mixtime. Any time class with a defined time_chronon() method can be converted (e.g. Date, POSIXct, yearmonth, etc.).

...

Additional arguments passed to the underlying vec_cast() method.

Value

A mixtime object corresponding to x.

See Also

mixtime() for constructing a mixtime directly from data, is_mixtime() for testing if an object is a mixtime.

Examples

as_mixtime(Sys.Date())
as_mixtime(Sys.time())


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