Aggregate measurements from a fine scaled time series into
a coarse time series. This is similar to functions from the
xts
package, but it can handle aggregation from weeks to
months.
1 2 3 4 5 6  AggregateTimeSeries(fine.series,
contains.end,
membership.fraction,
trim.left = any(membership.fraction < 1),
trim.right = NULL,
byrow = TRUE)

fine.series 
A numeric vector or matrix giving the fine scale time series to be aggregated. 
contains.end 
A logical vector corresponding to

membership.fraction 
A numeric vector corresponding to

trim.left 
Logical indicating whether the first observation in the coarse aggregate should be removed. 
trim.right 
Logical indicating whether the final observation in the coarse aggregate should be removed. 
byrow 
Logical. If 
A matrix (if fine.series
is a matrix) or vector
(otherwise) containing the aggregated values of fine.series
.
Steven L. Scott stevescott@google.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15  week.ending < as.Date(c("20111105",
"20111112",
"20111119",
"20111126",
"20111203",
"20111210",
"20111217",
"20111224",
"20111231"))
membership.fraction < GetFractionOfDaysInInitialMonth(week.ending)
which.month < MatchWeekToMonth(week.ending, as.Date("20111101"))
contains.end < WeekEndsMonth(week.ending)
weekly.values < rnorm(length(week.ending))
monthly.values < AggregateTimeSeries(weekly.values, contains.end, membership.fraction)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.