projectDate: Time Projection

Description Usage Arguments Examples

View source: R/projection.R

Description

Project dates to lower dimensional subspace. Extracts components year, month, yday, mday, hour, minute, weekday, bizday and season from a date object

Usage

1
2
3
  projectDate(dates, size = c("narrow", "wide"),
    holidays = holidayNYSE(year = unique(year(dates))),
    as.numeric = F, drop = T)

Arguments

dates

date or datetime objects

size

either "narrow" or "wide". If narrow, returns a data frame containing the projections as column variables using factors. If wide, returns a sparse matrix containing the projections as column variables using 0-1 variables

holidays

argument to determine which days are considered holidays, affecting the business day projection. By default uses holidayNYSE() provided by the timeDate package, or can be specified as a vector of strings representing dates in the yyyy-mm-dd format

as.numeric

logical only used when size = "narrow". Returns the columns as numeric values instead of factors

drop

logical. If true, drop any column that only has 1 level or only 1 unique element in it

Examples

1
2
dates = timeSequence(from = "2001-01-01", to = "2004-01-01", by = "day")
   projectDate(as.Date(dates))

TimeProjection documentation built on May 2, 2019, 7:30 a.m.