[R] Calculate a mean for several months for several years

Pete Brecknock Peter.Brecknock at bp.com
Tue Feb 22 04:30:24 CET 2011


For 5 years ....

set.seed = 1
d=data.frame(year=rep(2007:2011,each=12), month=rep(1:12,5), meanTemp =
rnorm(60,10,5))
meanByMonth = ave(d$meanTemp, d$month, FUN = mean)[7:9]

HTH

Pete
-- 
View this message in context: http://r.789695.n4.nabble.com/Calculate-a-mean-for-several-months-for-several-years-tp3318363p3318501.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list