colCum {timeSeries} | R Documentation |
Cumulated column statistics
Description
Functions to compute cumulative column statistics.
Usage
## S4 method for signature 'timeSeries'
colCumsums(x, na.rm = FALSE, ...)
## S4 method for signature 'timeSeries'
colCummaxs(x, na.rm = FALSE, ...)
## S4 method for signature 'timeSeries'
colCummins(x, na.rm = FALSE, ...)
## S4 method for signature 'timeSeries'
colCumprods(x, na.rm = FALSE, ...)
## S4 method for signature 'timeSeries'
colCumreturns(x, method = c("geometric", "simple"),
na.rm = FALSE, ...)
Arguments
x |
a time series, may be an object of class |
na.rm |
a logical. Should missing values be removed? |
method |
a character string to indicate if geometric ( |
... |
arguments to be passed. |
Details
These functions compute the requested cumulative quantities columnwise
to obtain a matrix of the same dimension as the data. The
"timeSeries"
methods replace the data part of the original
object with the resulting matrix.
The "timeSeries"
methods for the Math
group functions
cummin
, cummax
, cumsum
, and cumprod
,
work similarly but don't have the na.rm
argument.
Value
"matrix"
for the default methods of all functions,
"timeSeries"
for the "timeSeries"
methods
See Also
Math,timeSeries-method
,
rowCumsums
Examples
## simulate return data
x <- matrix(rnorm(24), ncol = 2)
X <- as.timeSeries(x)
## cumulative sums by column -
class(colCumsums(x)) # "matrix"
class(colCumsums(X)) # "timeSeries"
colCumsums(X)