I have daily temperature values for several years, 1949-2010. I would like to calculate monthly means. Here is an example of the data:
head(tmeasmax) TIMESTE
You can use the lubridate package to create a new factor variable consisting of the year-month combinations, then use aggregate.
lubridate
aggregate
library('lubridate') tmeasmax2 <- within(tmeasmax, { monthlies <- paste(year(TIMESTEP), month(TIMESTEP)) }) aggregate(tmeasmax2, list(monthlies), mean, na.rm = TRUE)