Last chance! 50% off unlimited learning
Sale ends in
Method to automatically convert an ‘xts’ object to an environment containing vectors representing each column of the original xts object. Each objects will be named according to the column name it is exracted by.
# S3 method for xts
as.environment(x)
an xts
object
An environment
containing ncol(x)
vectors
extracted by column from x
. Note that environments
do not preserve (or have knowledge) of column position, a.k.a order.
An experimental tool to convert xts
objects into environments
for simplifying use withing the standard R formula/data paradigm.
# NOT RUN {
x <- xts(1:10, Sys.Date()+1:10)
colnames(x) <- "X"
y <- xts(1:10, Sys.Date()+1:10)
colnames(x) <- "Y"
xy <- cbind(x,y)
colnames(xy)
e <- as.environment(xy) # currently using xts-style positive k
ls(xy)
ls.str(xy)
# }
Run the code above in your browser using DataLab