[R] Problem with zoo::window()
Gabor Grothendieck
ggrothendieck at gmail.com
Tue Sep 27 14:43:55 CEST 2011
On Tue, Sep 27, 2011 at 5:23 AM, Agustin Lobo
<Agustin.Lobo at ictja.csic.es> wrote:
> I have the following time series:
>
>> class(CCasadesz2)
> [1] "zoo"
>> setmanes <- cut(time(CCasadesz2),breaks="weeks")
>> CCasadeswz <- aggregate(CCasadesz2,sum,by=setmanes)
cut produces a "factor", not a "Date". The by= argument in
aggregate.zoo should not be a factor but rather should define the new
index. If you want the new index to be a "Date" class then by= should
define a "Date" vector. See ?aggregate.zoo .
Try:
setmanes <- as.Date(format(setmanes))
--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com
More information about the R-help
mailing list