date_month_factor {clock} | R Documentation |
Convert a date or date-time to an ordered factor of month names
Description
date_month_factor()
extracts the month values from a date or date-time and
converts them to an ordered factor of month names. This can be useful in
combination with ggplot2, or for modeling.
Usage
date_month_factor(x, ..., labels = "en", abbreviate = FALSE)
Arguments
x |
A date or date-time 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 |
Value
An ordered factor representing the months.
Examples
x <- add_months(as.Date("2019-01-01"), 0:11)
date_month_factor(x)
date_month_factor(x, abbreviate = TRUE)
date_month_factor(x, labels = "fr")
[Package clock version 0.7.1 Index]