Dear all, please consider my following workbook:

 

library(zoo)

lis1 <- vector('list', length = 2)

lis2 <- vector('list', length = 2)

lis1[[1]] <- zooreg(rnorm(20), start = as.Date("2010-01-01"), frequency = 1)

lis1[[2]] <- zooreg(rnorm(20), start = as.yearmon("2010-01-01"), frequency =
12)

 

lis2[[1]] <- matrix(1:40, 20)

lis2[[2]] <- matrix(41:80, 20)

 

Now I want to make each element of 'lis2' as zoo object where the
corresponding indices will be borrowed from 'lis1'. This means:

 

for (i in 1:2) {

                                lis2[[i]] <- zoo(lis2[[i]],
index(lis1[[i]]))

                }

 

However is there any faster way to do that? I found that if the sizes of
lis1 & lis2 is quite big then it takes lot of time to complete.

 

Any help will be really appreciated.

 

Thanks,


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to