coredata.xts | R Documentation |
Mechanism to extract and replace the core data of an xts object.
## S3 method for class 'xts'
coredata(x, fmt = FALSE, ...)
xcoredata(x, ...)
xcoredata(x) <- value
x |
An xts object. |
fmt |
Should the rownames be formated using |
... |
Unused. |
value |
Non-core attributes to assign. |
Extract coredata of an xts object - removing all attributes except
dim
and dimnames
and returning a matrix object with rownames
converted from the index of the xts object.
The rownames of the result use the format specified by tformat(x)
when
fmt = TRUE
. When fmt
is a character string to be passed to format()
.
See strptime()
for valid format strings. Setting fmt = FALSE
will
return the row names by simply coercing the index class to a character
string in the default manner.
xcoredata()
is the complement to coredata()
. It returns all of the
attributes normally removed by coredata()
. Its purpose, along with the
the replacement function xcoredata<-
is primarily for developers using
xts' try.xts()
and reclass()
functionality inside functions
so the functions can take any time series class as an input and return the
same time series class.
Returns either a matrix object for coredata, or a list of named attributes.
The replacement functions are called for their side-effects.
Jeffrey A. Ryan
coredata()
, xtsAttributes()
data(sample_matrix)
x <- as.xts(sample_matrix, myattr=100)
coredata(x)
xcoredata(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.