[R] tapply for function taking of >1 argument?
gunter.berton at gene.com
Tue Feb 2 22:24:14 CET 2010
Genentech Nonclinical Statistics
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of sjaffe
Sent: Tuesday, February 02, 2010 1:16 PM
To: r-help at r-project.org
Subject: Re: [R] tapply for function taking of >1 argument?
'fraid not :-((
tapply( data, groups, weighted.mean, weights)
won't work because the *entire* weights vector is passed as the 2nd arg to
weighted.means. But weighted.mean needs 'weights' to be split in the same
way as 'data' -- the first and 2nd args need to correspond.
Jorge Ivan Velez wrote:
> Hi sjaffem,
> You were almost there:
> tapply( yourdata, groups, weighted.mean, weights)
> See ?tapply for more information.
View this message in context:
Sent from the R help mailing list archive at Nabble.com.
R-help at r-project.org mailing list
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
More information about the R-help