new_cyclical_time_fn() creates a cyclical time function for a specified
chronon and cycle. The cycle is the larger time unit that defines the time
period over which the chronon loops (e.g., a week). The chronon is the smaller
time unit that iterates within each cycle (e.g., a day). Combined, these two
units form a cyclical time point (e.g., day of the week).
Examples
day_of_week <- new_cyclical_time_fn(day(1L), week(1L), fallback_calendar = cal_isoweek)
day_of_week(Sys.Date())
#> <mixtime[1]>
#> [1] Tue
month_of_year <- new_cyclical_time_fn(month(1L), year(1L))
month_of_year(Sys.Date())
#> <mixtime[1]>
#> [1] Feb