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

dimnames.xts

Dimnames of an xts Object


Description

Get or set dimnames of an xts object.

Usage

## S3 method for class 'xts'
dimnames(x)

## S3 replacement method for class 'xts'
dimnames(x) <- value

Arguments

x

an xts object

value

a list object of length two. See Details.

Details

The functions dimnames.xts and dimnames<-.xts are methods for the base functions dimnames and dimnames<-.

xts objects by design are intended for lightweight management of time-indexed data.

Rownames are redundant in this design, as well as quite burdensome with respect to memory consumption and internal copying costs.

rownames and colnames in R make use of dimnames method dispatch internally, and thus require only modifications to dimnames to enforce the xts no rownames requirement.

To prevent accidental setting of rownames, dimnames<- for xts will simply set the rownames to NULL when invoked, regardless of attempts to set otherwise.

This is done for internal compatibility reasons, as well as to provide consistency in performance regardless of object use.

User level interaction with either dimnames or rownames will produce a character vector of the index, formatted based on the current specification of indexFormat. This occurs within the call by converting the results of calling index(x) to a character string, which itself first creates the object type specified internally from the underlying numeric time representation.

Value

A list or character string containing coerced row names and/or actual column names.

Attempts to set rownames on xts objects via rownames or dimnames will silently fail. This is your warning.

Note

All xts objects have dimension. There are no xts objects representable as named or unnamed vectors.

Author(s)

Jeffrey A. Ryan

See Also

Examples

x <- xts(1:10, Sys.Date()+1:10)
dimnames(x)
rownames(x)
rownames(x) <- 1:10
rownames(x)
str(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.