On Mon, Jun 14, 2010 at 6:13 PM, steven mosher <mosherste...@gmail.com> wrote: > The zoo package as a merge function which merges a set of zoo objects > result<-merge(zoo1,zoo2,...) > > Assume your zoo objects are already collected in a list > > # make a phony list to illustrate the situation. ( hat tip to david W for > constructing a list in a loop) > > ddat <- as.list(rep("", 20)) > ytd<-seq(3,14) > for(i in 1:20) { > + ddat[[i]] <- zoo(data,ytd ) > + } > >
merge.zoo can handle multiple zoo objects (not just two) so: do.call("merge", ddat) This also works but is a bit tedious: merge(ddat[[1]], ddat[[2]], ddat[[3]], ddat[[4]], ddat[[5]], ddat[[6]], ddat[[7]], ddat[[8]], ddat[[9]], ddat[[10]], ddat[[11]], ddat[[12]], ddat[[13]], ddat[[14]], ddat[[15]], ddat[[16]], ddat[[17]], ddat[[18]], ddat[[19]], ddat[[20]]) Also note that there is an example of using do.call with merge.zoo in the examples section of ?merge.zoo ______________________________________________ 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.