timeSeries Class, Functions and Methods
Aggregates a 'timeSeries' Object.
1 2 3 4 5
an object of class 'timeSeries'.
a sequence of
the function to be applied.
a string value, specifying the day of week as a three
letter abbreviation. Weekly aggregated data records
are then fixed to the weekdays given by the argument
a logical value, if set to
arguments passed to other methods.
aggregate is a function which can
aggregate time series on general aggregation periods.
In addition there are two tailored function for simple
which allow to aggregate 'timeSeries' objects from daily
to monthly or weekly levels, respectively.
In the case of the function
daily2weekly one can
explicitely the starting day of the week, the default
value is Tuesday,
aggregate returns an aggregated S4 object of class
daily2monthly returns an aggregated monthly object
daily2weekly returns an aggregated weekly object
timeSeries starting on the specified day
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
## Load Microsoft Data Set - 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)) X <- aggregate(x, by, mean) X dayOfWeek(time(X)) isMonthly(X) ## Aggregate to Last Day of Quarter - by <- unique(timeLastDayInQuarter(time(x))) X <- aggregate(x, by, mean) X isQuarterly(X) ## Aggregate daily records to end of month records - X <- daily2monthly(x) X isMonthly(X) ## Aggregate da, ily records to end of week records - X <- daily2weekly(x, startOn="Fri") X dayOfWeek(time(X))