Re: [R] how to make monthly time series out of daily

From: Jannis <bt_jannis_at_yahoo.de>
Date: Tue, 01 Jun 2010 23:22:36 +0200

I am not sure about specific timeseries objects, but using an ordinary vector with the values the aggregate() function works fine:

monthly.means <- aggregate(timeseries, mean, by=months)

months now only has to be a vector of length(timeseries) with numbers relating each entry in timeseries to a unique month. My (not very elegant) way would be to create a unique index by extracting the year and the month from a time vector and combining them into one number, so that 10.2001 would result in 200110. I am sure there are more elegant ways using timeseries objects or something similar.

HTH
Jannis

Reto Baumgartner schrieb:
> I am using the Rmetrics package and would like to convert a daily
> price time serie into a monthly one. In SPlus I could use:
> aggregateSeries(timeSerie, by="months",FUN=first).
>
> ______________________________________________
> R-help_at_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.
>
>



R-help_at_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. Received on Tue 01 Jun 2010 - 21:27:08 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 Tue 01 Jun 2010 - 23:10:25 GMT.

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

list of date sections of archive