[R] Re: Convert daily to weekly ts ?
mail at fwr.on.ca
Wed Oct 2 22:56:17 CEST 2002
>Have 3.5 years daily data that I want to convert to weekly. Looking for something
> like SAS's "expand" function, where you can specify the conversion function (sum,
> average, etc.) and get a new vector out with different sampling frequencies.
OK, think I see what to do. The ts class has no calendar/date functions, it assumes a constant delta-t. So I could use "aggregate.ts" on my daily data with a ts having a defined frequency of 364 and knock it down to 52. That would work ok.
However, for calendar/date based aggregation to monthly/quarterly/yearly summaries I need to first create the appropriate factor based on a POSIX date vector and then use that in the "by" variable of "aggregate.data.frame"
I think ...
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help