Description Usage Arguments Value designmatrix functions Examples
The designmatrix package creates deisgn/model matrices for dates. The workhorse designMatrix function supports many differetn terms (e.g. weekday, month, leap years, holidays, etc). Some of these are in development and as yet not implemented.
1 2 3 4 5 |
x |
A vector of dates. |
weekdays |
A character vector of the weekdays to include. |
months |
A numeric vector of the months to include. |
holidays |
TODO (A character vector of the holidays to include.) |
years |
A numeric vector of the years to include. |
interactions |
TODO (A character vector of the weekdays to include.) |
dayOfMonth |
TODO A numeric vector of the day of the month to include. |
daysInMonth |
TODO A numeric vector of the days in the month to include. |
leapYear |
TODO A logical that includes to include a leap year indicator. |
quarters |
TODO A character vector of the quarters to include. |
weeks |
TODOA numeric vector to include the week number of the year. |
weekend |
A logical that indicates if a weekend (Saturday or Sunday) indicator should be included |
weekday |
A logical that indicates if a weekday (Monday through Friday) indicator should be included |
removeUnusedLevels |
A TODO logical that indicates if colinear terms of the return matrix should be removed by dropping columns with zero variance. |
returnType |
TODO A character vector indicating the data type for the return matrix. Acceptable values are "integer", "factor", "numeric", and "logical". |
The design matrix for the input dates.
designMatrix
1 2 3 4 5 | alldates <- seq(from = as.Date("2000-01-01"), to = as.Date("2005-10-01"), by = "days")
designMatrix(x = alldates, weekdays = "all", months = "January")
designMatrix(x = alldates, weekdays = c("Wednesday", "Friday"), quarters = "all")
designMatrix(x = alldates, months = "all", years = c(2002, 2004))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.