aggregate-methods {timeSeries}R Documentation

timeSeries Class, Functions and Methods

Description

Aggregates a 'timeSeries' Object.

Usage

## S4 method for signature 'timeSeries':
aggregate(x, by, FUN, ...)

Arguments

by [aggregate] -
a character string denoting the aggregation period
FUN the function to be applied.
x an object of class timeSeries.
... arguments passed to other methods.

Value

returns an aggregated S4 object of class timeSeries.

Examples

## data -
   x <- as.timeSeries(data(msft.dat))

## 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)   


[Package timeSeries version 290.79 Index]