Learn R Programming

bsts (version 0.6.1)

extend.time: Extends a vector of dates to a given length

Description

Pads a vector of dates to a specified length.

Usage

ExtendTime(dates, number.of.periods, dt = NULL)

Arguments

dates
An ordered vector of class Date.
number.of.periods
The desired length of the output.
dt
A character string describing the frequency of the dates in dates. Possible values are "daily", "weekly", "monthly", "quarterly", "yearly", or "other". An attempt to deduce dt will be made if it is missing.

Value

  • If number.of.periods is longer than length(dates), then dates will be padded to the desired length. Extra dates are added at time intervals matching the average interval in dates. Thus they may not be

See Also

bsts.mixed.

Examples

Run this code
origin.month <- as.Date("2011-09-01")
  week.ending <- as.Date(c("2011-10-01",   ## 1
                           "2011-10-08",   ## 2
                           "2011-12-03",   ## 3
                           "2011-12-31"))  ## 4
  MatchWeekToMonth(week.ending, origin.month) == 1:4

Run the code above in your browser using DataLab