[R] List of zoo multivariate series

Allan Engelhardt allane at cybaea.com
Wed Jun 30 11:26:07 CEST 2010


help("[[")

e.g.

plot(test[[2]])

Hope this helps

Allan

On 30/06/10 10:09, Research wrote:
> Hi,
>
> I have a list which is basically a database of zoo multivariate objects:
>
>      x.Date <- as.Date("2003-02-01") + c(1:100) - 1
>      x <- zoo(rnorm(100), x.Date)
>      z <- zoo(rnorm(100), x.Date)
>      y <- zoo(rnorm(100), x.Date)
>      k <- zoo(rnorm(100), x.Date)
>
>     a<-merge(x,z)
>     b<-merge(y,k)
>     c<-merge(z,x,y)
>
>     test<-list(a=a, b=b, c=c)
>
> Can I access the elements of the list in a for/next do loop?
>
> for example something like:
>
> for (i in 1:3)
> {
>     x11()
>     plot(test[i])
> }
>
> So far I can only recover the zoo objects as test$a, test$b etc. etc...
>
> Thanks,
> Costas
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list