Try this:

aggregate(TEMP ~ Year + Month + Day, DF, mean)

On Tue, Nov 16, 2010 at 4:48 PM, facehappywy <yiw...@gmail.com> wrote:

>
> Thanks every one first.
>
> I have a dataset like this
>
> Year    Month   Day     Hour    DIR     SPD (m/s)       SKYCOVER
>  TEMP (C)        RH(%)
> 2009    1       1       0       310     13.85824        3       -5      23
> 2009    1       1       1       330     14.30528        3
> -7.222222222    26
> 2009    1       1       2       320     10.72896        3
> -7.222222222    24
> 2009    1       1       3       320     10.72896        3
> -6.666666667    23
> 2009    1       1       4       320     10.28192        3
> -7.222222222    26
> 2009    1       1       5       330     10.28192        3
> -7.222222222    26
> 2009    1       1       6       330     10.28192        3
> -7.222222222    25
> 2009    1       1       6       320     12.96416        3
> -7.222222222    26
> 2009    1       1       7       330     11.176  3       -7.222222222    26
> 2009    1       1       8       330     10.72896        3
> -7.777777778    28
> 2009    1       1       9       330     10.72896        3
> -7.777777778    27
> 2009    1       1       9       320     11.176  3       -7.222222222    26
> 2009    1       1       10      320     12.51712        3
> -7.777777778    24
> 2009    1       1       11      310     9.83488 3       -7.777777778    24
> 2009    1       1       12      310     9.83488 3       -8.333333333    25
> 2009    1       1       12      310     10.72896        3
> -8.888888889    26
> 2009    1       1       13      320     9.83488 3       -7.777777778    26
> 2009    1       1       14      310     9.83488 3       -7.222222222    23
> 2009    1       1       15      310     9.83488 3       -7.222222222    23
> 2009    1       1       15      320     10.72896        0
> -7.222222222    23
> 2009    1       1       16      320     8.04672 0       -6.111111111    21
> 2009    1       1       17      300     9.83488 0       -3.888888889    18
> 2009    1       1       18      300     9.83488 0       -4.444444444    19
> 2009    1       1       18      310     9.38784 0       -2.777777778    16
> 2009    1       1       19      320     7.59968 3       -2.777777778    16
> 2009    1       1       20      310     6.25856 3       -2.777777778    18
> 2009    1       1       21      310     6.25856 3       -2.777777778    18
> 2009    1       1       21      310     7.15264 3       -2.777777778    16
> 2009    1       1       22      310     7.59968 3       -2.777777778    16
> 2009    1       1       23      300     5.81152 3       -3.888888889    16
>
>
> It is a one year (2009), 12 month, every day, every hour data. Notice that
> there are sometimes several readings  within one hour. I want to calculate
> the hourly avg for each day in each month. Anyone could help me on this.
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Please-help-me-on-a-simple-avg-question-tp3045440p3045440.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help@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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to