Time Projections

Extract useful time components of a date object, such as day of week, weekend, holiday, day of month, etc, and put it in a data frame. This can be used to create many predictor variables out of a single time variable, which can then be used in a regression or decision tree. Also includes function plotCalendarHeatmap which draws a calendar and overlays a heatmap based on values.

TimeProjection on CRAN

Time projections take a date/datetime object, representing a specific instance in time, and projects it down to a lower dimensional subspace. A lower dimensional subspace for time could be the subspace Day of Week, where we take an instance of time such as 2012-12-31 13:47 UTC-0800 and just project it down to "Monday". A projection essentially grabs one major component of a date/dateitme. Useful components to extract are day of week, weekend vs weekday, holiday, month, day of month, and year.

Using one single time variable, we can extract many more useful time variables. This can be particularly useful for constructing regressions and decision trees. The projections can be used as predictor variables in a linear regression in order to analyze seasonality and trends, and can also be used as predictor variables in a decision tree.

TimeProjection creates a data frame that can be in one of two forms: narrow or wide. Suppose we wanted to get the Day of Week projection as a data frame; using narrow, we would get one single column variable of factors, and each date object would fall under one of Mon-Sun. This is a very compact form and useful for decision trees. In the wide format, we would get 7 column variables using 0's or 1's, one column for each day of week. The column is 1 if the date falls into that projected point - this is a much more useful form when constructing linear regressions.


Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.


0.2.0 by Jeffrey Wong, 8 years ago


Browse source code at https://github.com/cran/TimeProjection

Authors: Jeffrey Wong

Documentation:   PDF Manual  

Task views: Time Series Analysis

GPL-3 license

Depends on lubridate, timeDate, Matrix

Suggests testthat, roxygen2, ggplot2, plyr

See at CRAN