Solved it myself:
aggregate(mydata, by=mydata[c("MM","DD")], FUN=mean)
Thank you.
# -----------------------------------------------------------------------------
My dataframe looks like this:> mydata
X.YY MM DD hh WDI R.WSP D.GST PRES ATMP DEWP
1 2015 1 1 0 328 3.6 4.5 1028.0 3.8 -3.5
2 2015 1 1 1 300 2.1 2.7 1027.9 3.7 -4.4
3 2015 1 1 2 264 2.4 2.9 1027.7 3.6 -4.5
4 2015 1 1 3 230 4.1 4.5 1027.4 4.2 -3.8
5 2015 1 1 4 242 8.1 9.2 1026.6 4.4 -3.1
6 2015 1 1 5 262 9.3 10.1 1026.6 4.1 -3.8
7 2015 1 1 6 267 8.6 9.6 1026.3 4.2 -3.8
8 2015 1 1 7 264 9.3 9.9 1026.1 3.9 -2.8
9 2015 1 1 8 268 8.2 9.1 1026.1 3.5 -3.0
10 2015 1 1 9 272 8.8 9.6 1025.4 3.2 -3.3 ?
The first four columns are year, month, day, hour (0 ? 23). I wish to take the
means of the next six columns (WDIR, WSPD, GST, PRES, ATMP and DEWP) by day.
[[alternative HTML version deleted]]