View source: R/generate_from_date.R
build_date_factor | R Documentation |
Map a vector of dates to a factor at one of these levels "yearmonth", "yearquarter", "quarter", "month"
build_date_factor(data_set, type = "yearmonth")
data_set |
A vector of date values |
type |
One of "year", "yearquarter", "yearmonth", "quarter", "month" |
The resulting vector is an ordered factor of the specified type
(e.g. yearmonth)
library(data.table)
data_set <- as.Date(c("2014-01-01", "2015-01-01", "2015-06-01"))
build_date_factor(data_set, type = "yearmonth")
build_date_factor(data_set, type = "yearquarter")
build_date_factor(data_set, type = "yearquarter")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.