This S7 generic function extracts the chronon (the smallest time unit) from a time object, such as continuous time or cyclical time representations.
time_chronon(x, ...)
A time object (e.g., base::Date, base::POSIXct, linear_time()
, etc.)
A time unit object representing the chronon (e.g., tu_day(1L)
)
# The chronon of a Date object is 1 day
time_chronon(Sys.Date())
#> <mixtime::tu_day>
#> @ x: int 1
# The chronon of a POSIXct object is 1 second
time_chronon(Sys.time())
#> <mixtime::tu_second>
#> @ x: int 1
# The chronon of a continuous time year and month is 1 month
time_chronon(yearmonth(Sys.Date()))
#> Error in loadNamespace(x): there is no package called ‘vecvec’
# The common chronon of a mixed time object is the finest chronon
time_chronon(c(yearmonth(Sys.Date()), Sys.Date()))
#> Error in loadNamespace(x): there is no package called ‘vecvec’