aggregate.weeks.to.months {bsts} | R Documentation |
Aggregate a weekly time series to monthly
Description
Aggregate measurements from a weekly time series into a monthly time series.
Usage
AggregateWeeksToMonths(weekly.series,
membership.fraction = NULL,
trim.left = TRUE,
trim.right = NULL)
Arguments
weekly.series |
A numeric vector or matrix of class
|
membership.fraction |
A optional numeric vector corresponding to
|
trim.left |
Logical indicating whether the first observation in the monthly aggregate should be removed. |
trim.right |
Logical indicating whether the final observation in the monthly aggregate should be removed. |
Value
A zoo-matrix (if weekly.series
is a matrix) or vector
(otherwise) containing the aggregated values of weekly.series
.
Author(s)
Steven L. Scott steve.the.bayesian@gmail.com
See Also
Examples
week.ending <- as.Date(c("2011-11-05",
"2011-11-12",
"2011-11-19",
"2011-11-26",
"2011-12-03",
"2011-12-10",
"2011-12-17",
"2011-12-24",
"2011-12-31"))
weekly.values <- zoo(rnorm(length(week.ending)), week.ending)
monthly.values <- AggregateWeeksToMonths(weekly.values)