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

coredata.xts

Extract/Replace Core Data of an xts Object


Description

Mechanism to extract and replace the core data of an xts object.

Usage

## S3 method for class 'xts'
coredata(x, fmt=FALSE, ...)

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

Arguments

x

an xts object

fmt

should the rownames be formated in a non-standard way

value

non-core attributes to assign

...

further arguments [unused]

Details

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 fmt argument, if TRUE, allows the internal index formatting specified by the user to be used. Alternatively, it may be a valid formatting string to be passed to format. Setting to FALSE will return the row names by simply coercing the index class to a character string in the default manner.

xcoredata is the functional complement to coredata, returning all of the attributes normally removed by coredata. Its purpose, along with the replacement function xcoredata<- is primarily for use by developers using xts to allow for internal replacement of values removed during use of non xts-aware functions.

Value

Returns either a matrix object for coredata, or a list of named attributes.

The replacement functions are called for their side-effects.

Author(s)

Jeffrey A. Ryan

See Also

Examples

data(sample_matrix)
x <- as.xts(sample_matrix, myattr=100)
coredata(x)
xcoredata(x)

xts

eXtensible Time Series

v0.12.1
GPL (>= 2)
Authors
Jeffrey A. Ryan [aut, cph], Joshua M. Ulrich [cre, aut], Ross Bennett [ctb], Corwin Joy [ctb]
Initial release

We don't support your browser anymore

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