[R] convert weekly time series data to monthly

From: Richard Saba <sabaric_at_auburn.edu>
Date: Sun, 30 Mar 2008 10:24:20 -0500

I have weekly time series data with year, month, day, and price variables. The input data set for the weekly series takes the following form:

 Year	month	day 	price
1990	8	20	119.1		
1990	8	27	124.5
1990	9	3	124.2
1990	9	10	125.2
1990	9	17	126.6
1990	9	24	127.2
1990	10	1	132.1
1990	10	8	133.3
1990	10	15	133.9
1990	10	22	134.5
1990	10	29	133.9
..	...	...	...
...	...	....	....
2008	3	3	313.7
2008	3	10	320
2008	3	17	325.7
2008	3	24	322.4 


I would like to collapse the data into monthly averages to merge with a monthly series. The input data set for the monthly series takes the following form:

M-Y		Year	Month	Change
Aug-1990	1990	8	-226.871
Sep-1990	1990	9	-896.333
Oct-1990	1990	10	111.419
Nov-1990	1990	11	-364.2
Dec-1990	1990	12	-527.645
Jan-1991	1991	1	-70.935
Feb-1991	1991	2	231.214
Mar-1991	1991	3	-239 

...	...	.....	..	....


The merged data set should be of class(ts). I can perform the conversions outside of R and then import but I would rather perform all conversions within R. I have looked through the zoo and Rmetrics packages but without success.

Any help will be appreciated.
Thanks,

Richard Saba
Department of Economics
Auburn University
Email: sabaric_at_auburn.edu
Phone: 334 844-2922



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 Sun 30 Mar 2008 - 15:28:33 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 Sun 30 Mar 2008 - 17:30: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