Skip to contents

Extract and replace non-core xts attributes.

Usage

xtsAttributes(x, user = NULL)

xtsAttributes(x) <- value

Arguments

x

An xts object.

user

Should user-defined attributes be returned? The default of NULL returns all xts attributes.

value

A list of new name = value attributes.

Value

A named list of user-defined attributes.

Details

This function allows users to assign custom attributes to the xts objects, without altering core xts attributes (i.e. tclass, tzone, and tformat).

attributes() returns all attributes, including core attributes of the xts class.

See also

Author

Jeffrey A. Ryan

Examples


x <- xts(matrix(1:(9*6),nc=6),
         order.by=as.Date(13000,origin="1970-01-01")+1:9,
         a1='my attribute')

xtsAttributes(x)
#> $a1
#> [1] "my attribute"
#> 
xtsAttributes(x) <- list(a2=2020)

xtsAttributes(x)
#> $a1
#> [1] "my attribute"
#> 
#> $a2
#> [1] 2020
#> 
xtsAttributes(x) <- list(a1=NULL)
xtsAttributes(x)
#> $a2
#> [1] 2020
#>