[R] Creating quarterly data

Thomas Jensen thomas.jensen at eup.gess.ethz.ch
Mon Jun 28 14:23:09 CEST 2010


Dear R Experts,

I have data in the following format

x1	x2	time
2	4	1
3	1	2
4	6	3
1	4	4	
5	6	5	
8	5	6
.	.	.
.	.	.
.	.	.
1	5	399
3	4	400

Time represents each month which simply has a number from 1 to 400  
(i.e. the data covers 400 months). I would like to somehow create two  
new variables which counts x1 and x2 as quarterly data in stead of  
monthly. Like this:

x1	x1	Quarter
10	12	1
12	15	2
.	.	.
.	.	.
.	.	.
23	21	100

Can any one tell me how this can be done in R?

With kind regards,
Thomas Jensen



More information about the R-help mailing list