Skip to content
Prev 166767 / 398502 Next

roll weekly data to monthly level

Try this. First we read in the data.  In reality you would use
the commented out read line.   Then use chron to convert
the times to chron dates and as.yearmon from zoo to convert
them to year/months.  Finally aggregate and sort.
+ 1    2/01/2008    4
+ 1    2/09/2008    12
+ 1    9/01/2008    8
+ 2    1/06/2008    3
+ 2    3/01/2008    4
+ 2    3/09/2008    9
+ 2    6/03/2008    4
+ 3    1/02/2008    3
+ 3    1/10/2008    8
+ 3    2/02/2008    7
+ 3    2/10/2008    3"
ID  yearmon  y
3  1 Feb 2008 16
7  1 Sep 2008  8
1  2 Jan 2008  3
5  2 Mar 2008 13
6  2 Jun 2008  4
2  3 Jan 2008 11
4  3 Feb 2008 10

        
On Mon, Jan 12, 2009 at 4:57 PM, liujb <liujulia7 at yahoo.com> wrote: