On 11/18/2011 01:05 PM, saschav...@gmail.com wrote: > daf <- data.frame( > 'id' = rep(1:5, 3), > matrix(1:60, nrow=15, dimnames=list( NULL, paste('v', 1:4, sep='') )), > rep = rep(1:3, each=5) > ) Hi,
This seems like a job for plyr! library(plyr) ddply(daf, .(rep), summarise, mn = mean(v1)) hope this helps, Paul -- Paul Hiemstra, Ph.D. Global Climate Division Royal Netherlands Meteorological Institute (KNMI) Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39 P.O. Box 201 | 3730 AE | De Bilt tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770 ______________________________________________ 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.