weekday_factor {clock} | R Documentation |
Convert a weekday to an ordered factor
Description
weekday_factor()
converts a weekday object to an ordered factor. This
can be useful in combination with ggplot2, or for modeling.
Usage
weekday_factor(x, ..., labels = "en", abbreviate = TRUE, encoding = "western")
Arguments
x |
A weekday vector. |
... |
These dots are for future extensions and must be empty. |
labels |
Character representations of localized weekday names, month names, and
AM/PM names. Either the language code as string (passed on to
|
abbreviate |
If If |
encoding |
One of:
|
Value
An ordered factor representing the weekdays.
Examples
x <- weekday(1:7)
# Default to Sunday -> Saturday
weekday_factor(x)
# ISO encoding is Monday -> Sunday
weekday_factor(x, encoding = "iso")
# With full names
weekday_factor(x, abbreviate = FALSE)
# Or a different language
weekday_factor(x, labels = "fr")