[R] creating conditional means

Sherri Heck sheck at ucar.edu
Sat Dec 1 21:57:17 CET 2007


Hi all-

I have a dataset (year, month, hour, co2(ppm), num1,num2)


[49,] 2006   11    0 383.3709   28   28
[50,] 2006   11    1 383.3709   28   28
[51,] 2006   11    2 383.3709   28   28
[52,] 2006   11    3 383.3709   28   28
[53,] 2006   11    4 383.3709   28   28
[54,] 2006   11    5 383.3709   28   28
[55,] 2006   11    6 383.3709   28   28
[56,] 2006   11    7 383.3709   28   28
[57,] 2006   11    8 383.3709   28   28
[58,] 2006   11    9 383.3709   27   27
[59,] 2006   11   10 383.3709   28   28

that repeats in this style for each month.  I would like to compute the 
mean for each hour in three month intervals.
i.e.  average all 2pms for each day for months march, april and may. and 
then do this for each hour interval.
i have been messing around with 'for loops' but can't seem to get the 
output I want.

thanks in advance for any help-

s.heck
CU, Boulder



More information about the R-help mailing list