aggregate-methods {timeSeries} | R Documentation |
Aggregates a 'timeSeries' Object.
## S4 method for signature 'timeSeries' aggregate(x, by, FUN, ...)
by |
[aggregate] - |
FUN |
the function to be applied. |
x |
an object of class |
... |
arguments passed to other methods. |
returns an aggregated S4 object of class timeSeries
.
## Load Microsoft Data Set - data(MSFT) x <- MSFT ## Aggregate by Weeks - by <- timeSequence(from = start(x), to = end(x), by = "week") aggregate(x, by, mean) ## Aggregate to Last Friday of Month - by <- unique(timeLastNdayInMonth(time(x), 5)) aggregate(x, by, mean) ## Aggregate to Last Day of Quarter - by <- unique(timeLastDayInQuarter(time(x))) aggregate(x, by, mean)