This S7 generic function provides the labels for cyclical relationships between time units. These functions should return locale specific labels.

cyclical_labels(granule, cycle, ...)

Arguments

granule

A time unit object representing the granule (e.g., tu_month(1L))

cycle

A time unit object representing the cycle (e.g., tu_year(1L))

Value

Character vector of labels for the time point within the cycle.

Examples

# Labels for months in a year
cyclical_labels(tu_month(1L), tu_year(1L), 1:12)
#>  [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"

# Labels for days in a week
cyclical_labels(tu_day(1L), tu_week(1L), 1:7)
#> [1] "Thu" "Fri" "Sat" "Sun" "Mon" "Tue" "Wed"

# Labels for weeks in a year, defaulted from time_unit_abbr()
cyclical_labels(tu_week(1L), tu_year(1L), 1:52)
#>  [1] "W1"  "W2"  "W3"  "W4"  "W5"  "W6"  "W7"  "W8"  "W9"  "W10" "W11" "W12"
#> [13] "W13" "W14" "W15" "W16" "W17" "W18" "W19" "W20" "W21" "W22" "W23" "W24"
#> [25] "W25" "W26" "W27" "W28" "W29" "W30" "W31" "W32" "W33" "W34" "W35" "W36"
#> [37] "W37" "W38" "W39" "W40" "W41" "W42" "W43" "W44" "W45" "W46" "W47" "W48"
#> [49] "W49" "W50" "W51" "W52"