Re: [Rd] [R] aggregate.ts

From: Achim Zeileis <Achim.Zeileis_at_wu-wien.ac.at>
Date: Wed, 25 Jul 2007 17:02:13 +0200 (CEST)


Paul,

thanks for the feedback. Concerning the zoo side:

> >Currently, the "zoo" implementation allows this: Coercing back and forth
> >gives:
> > library("zoo")
> > z1 <- as.ts(aggregate(as.zoo(x1), as.yearqtr, sum))
> > z2 <- as.ts(aggregate(as.zoo(x2), as.yearqtr, sum))
> >
> >
> This is better, but still potentially misleading. I would prefer a
> default NA when only some of the observations are available for a
> quarter

In such situations, I either extend the series first to a completely regular time grid, or modify the function that I use for aggregation to do exactly what I want it to do.

> (and the syntax is a bit cumbersome for something one needs to
> do fairly often).

I don't think
  aggregate(z, as.yearqtr, sum)
is really cumbersome. And the rest is just coercion back and forth between "ts" and "zoo"/"zooreg" (which can't be much easier, I guess). Z



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 25 Jul 2007 - 15:53:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 25 Jul 2007 - 16:36:50 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.