build_date_factor: Date Factor

View source: R/generate_from_date.R

build_date_factorR Documentation

Date Factor

Description

Map a vector of dates to a factor at one of these levels "yearmonth", "yearquarter", "quarter", "month"

Usage

build_date_factor(data_set, type = "yearmonth")

Arguments

data_set

A vector of date values

type

One of "year", "yearquarter", "yearmonth", "quarter", "month"

Details

The resulting vector is an ordered factor of the specified type (e.g. yearmonth)

Examples

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")


ELToulemonde/dataPreparation documentation built on July 19, 2023, 11:45 a.m.