aggregate(base,by=list(as.factor(format(dates(base),"%Y%m%d"))),mean,na.
rm=T)


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Vittorio
Sent: Friday, April 07, 2006 11:38 AM
To: [email protected]
Subject: [R] Aggregating an its series

I'm using a very long irregular time-series of air temperature and
relative humidity of this kind (this is an extract only)

its.format("%
Y%d%m %X)
> base
                                 T  H
20020601
12.00.00 27.1 47
20020601 15.00.00 29.1 39
20020601 18.00.00 27.4 39
20020601 21.00.00 24.0 40
20020602 0.00.00  22.0 73
20020602 3.00.00
19.2 49
20020602 6.00.00  19.5 74
20020602 9.00.00  24.8 45
20020602
12.00.00 27.7 NA
20020602 15.00.00 29.2 39
20020602 18.00.00 27.2 44
20020602 21.00.00 23.9 50
20020603 0.00.00  21.0 75
20020603 3.00.00
19.6 65
20020603 6.00.00  19.8 71
20020603 9.00.00  23.2 67
20020603
12.00.00 24.9 65
20020603 15.00.00 21.7 74
20020603 18.00.00 22.8 63
20020603 21.00.00 21.2 75
20020604 0.00.00  18.0 91

I would like to
aggregate T and H by day and produce another its of this kind

> aggr
               T   H
20020601 NA NA
20020602 NA NA
20020603 NA NA
20020604 NA NA

where the daily average of T and H (not counting the NA
values) is is put in aggr.

What is the quickest way to get this
result?

Thanks

Vittorio

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to