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