On Tue, Apr 7, 2009 at 4:41 PM, Jorge Ivan Velez
<jorgeivanve...@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/

______________________________________________
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.

Reply via email to