weekday_factor() converts a weekday object to an ordered factor. This
can be useful in combination with ggplot2, or for modeling.
weekday_factor(x, ..., labels = "en", abbreviate = TRUE, encoding = "western")
A weekday vector.
These dots are for future extensions and must be empty.
An ordered factor representing the weekdays.
x <- weekday(1:7) # Default to Sunday -> Saturday weekday_factor(x)#>  Sun Mon Tue Wed Thu Fri Sat #> Levels: Sun < Mon < Tue < Wed < Thu < Fri < Sat# ISO encoding is Monday -> Sunday weekday_factor(x, encoding = "iso")#>  Sun Mon Tue Wed Thu Fri Sat #> Levels: Mon < Tue < Wed < Thu < Fri < Sat < Sun# With full names weekday_factor(x, abbreviate = FALSE)#>  Sunday Monday Tuesday Wednesday Thursday Friday Saturday #> 7 Levels: Sunday < Monday < Tuesday < Wednesday < Thursday < ... < Saturday# Or a different language weekday_factor(x, labels = "fr")#>  dim. lun. mar. mer. jeu. ven. sam. #> Levels: dim. < lun. < mar. < mer. < jeu. < ven. < sam.