[R] list matching

Gabor Grothendieck ggrothendieck at gmail.com
Sun Oct 7 19:09:34 CEST 2007


On 10/7/07, Adrian Dusa <dusa.adrian at gmail.com> wrote:
> On Sunday 07 October 2007, Gabor Grothendieck wrote:
> > I thought the latest zoo fixes were on CRAN but perhaps they
> > are not.   Try this:
> >
> > library(zoo)
> > # next line loads latest version of merge.zoo (fixed in August)
> > source("http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/*checkout*/
> >pkg/R/merge.zoo.R?rev=361&root=zoo")
> >
> > as.vector(time(do.call(merge, c(lapply(aa, function(x) zoo(,x)), all =
> > FALSE))))
>
> Yeap, that fixes it.
> Ah-haa, so all = FALSE is merge()s argument...
> Neat :)
> Adrian

It also makes use of the fact that zoo is sufficiently general that the
times in the time series can be character strings.  For example, the
following time series has the value 1 at time "a", 2 at time "b", etc.

zoo(1:26, letters)



More information about the R-help mailing list