Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

coredata

Extracting/Replacing the Core Data of Objects


Description

Generic functions for extracting the core data contained in a (more complex) object and replacing it.

Usage

coredata(x, ...)
coredata(x) <- value

Arguments

x

an object.

...

further arguments passed to methods.

value

a suitable value object for use with x.

Value

In zoo, there are currently coredata methods for time series objects of class "zoo", "ts", "its", "irts", all of which strip off the index/time attributes and return only the observations. The are also corresponding replacement methods for these classes.

See Also

Examples

suppressWarnings(RNGversion("3.5.0"))
set.seed(1)

x.date <- as.Date(paste(2003, rep(1:4, 4:1), seq(1,20,2), sep = "-"))
x <- zoo(matrix(rnorm(20), ncol = 2), x.date)

## the full time series
x
## and only matrix of observations
coredata(x)

## change the observations
coredata(x) <- matrix(1:20, ncol = 2)
x

zoo

S3 Infrastructure for Regular and Irregular Time Series (Z's Ordered Observations)

v1.8-10
GPL-2 | GPL-3
Authors
Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>), Gabor Grothendieck [aut], Jeffrey A. Ryan [aut], Joshua M. Ulrich [ctb], Felix Andrews [ctb]
Initial release
2022-04-15

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.