On Tue, Apr 7, 2009 at 4:41 PM, Jorge Ivan Velez <jorgeivanvelez at gmail.com> wrote: > Hi Eik, > You're absolutely right. My bad. > > Here is the correction of the code I sent: > > apply(mydata[,-1], 2, tapply, mydata[,1], function(x) sum(x)/length(x)) Or more simply: apply(mydata[,-1], 2, tapply, mydata[,1], mean) Hadley -- http://had.co.nz/