series-methods | R Documentation |
Get and set the data component of a 'timeSeries'.
series(x)
series(x) <- value
x |
a |
value |
a |
series
returns the @.Data
slot of a timeSeries
object in matrix
form.
The assignment version of series
replaces the values of the
time series with value
. The row and column names of
value
are used if not NULL
, otherwise they are left as
in x
. The most natural use is when value
has the same
dimensions as as.matrix(x)
, but if that is not the case the
result is almost as if value
was converted to
"timeSeries"
directly.
Methods for zoo::coredata
and its assignment counterpart are
defined, as well. Users who wish to use them should ensure that
zoo::coredata
is visible (e.g., by calling
library('zoo')
or library('xts')
) or employ the
zoo::
prefix in the calls. These methods are equivalent to
series
and `series<-`
, respectively.
timeSeries
## A Dummy 'timeSeries' Object
ts <- timeSeries()
ts
## Get the Matrix Part -
mat <- series(ts)
class(mat)
mat
## Assign a New Univariate Series -
series(ts) <- rnorm(12)
ts
## Assign a New Bivariate Series -
series(ts) <- matrix(rnorm(12), ncol = 2)
ts
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.