| linear_time | R Documentation |
linear_time() creates a vector of linear time points with a specified
chronon (smallest time granule). This function is useful for creating custom
time representations that aren't covered by the convenience functions like
yearmonth() or yearweek().
linear_time(
data,
chronon = time_chronon(data),
discrete = TRUE,
calendar = time_calendar(data)
)
data |
Input data to convert to linear time. Can be:
|
chronon |
A time granule expression representing the chronon (smallest
indivisible time granule), evaluated in the context of |
discrete |
Logical. If |
calendar |
Calendar system used to evaluate |
A mixtime time vector containing an mt_linear vector.
new_linear_time_fn() for creating reusable linear time functions
yearmonth(), yearquarter(), year() for Gregorian time representations
yearweek() for ISO 8601 week-based time
cal_gregorian, cal_isoweek for calendar systems
# Hourly time
linear_time(
Sys.time(),
chronon = hour(1L)
)
# Monthly time
linear_time(
Sys.Date(),
chronon = month(1L)
)
# Discrete vs continuous time
linear_time(Sys.time(), chronon = day(1L), discrete = TRUE)
linear_time(Sys.time(), chronon = day(1L), discrete = FALSE)
# ISO week calendar with week-day structure
linear_time(
Sys.Date(),
chronon = day(1L),
calendar = cal_isoweek
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.