month.distance {bsts} | R Documentation |
Elapsed time in months
Description
The (integer) number of months between dates.
Usage
MonthDistance(dates, origin)
Arguments
dates |
A vector of class |
origin |
A scalar of class |
Value
Returns a numeric vector giving the integer number of months
that have elapsed between origin
and each element in
dates
. The daily component of each date is ignored, so two
dates that are in the same month will have the same measured
distance. Distances are signed, so months that occur before
origin
will have negative values.
Author(s)
Steven L. Scott steve.the.bayesian@gmail.com
Examples
dates <- as.Date(c("2008-04-17",
"2008-05-01",
"2008-05-31",
"2008-06-01"))
origin <- as.Date("2008-05-15")
MonthDistance(dates, origin) == c(-1, 0, 0, 1)
[Package bsts version 0.9.10 Index]