Reputation: 2654
Suppose I have the following multi-series zoo object:
X.Z <- structure(c(0, 0.01, 0.01, 0, 0, 0.01), .Dim = c(3L, 2L), .Dimnames = list(
NULL, c("FTSE100", "FTALLSH")), index = structure(c(5844,
5845, 5846), class = "Date"), class = "zoo")
I want to convert X.Z
into a list of zoo
objects called FTSE100
and FTALLSH
. I used the following:
X.Zs <- list()
for(i in 1:2){
X.Zs[[i]] <- X.Z[,i]
}
names(X.Zs) <- colnames(X.Z)
Is there any 'more' efficient way than the above?
My question is the reverse of this question
Upvotes: 2
Views: 336