Raw Message
Message-ID: <4FB7B9E9.1030809@sapo.pt>
Date: 2012-05-19T15:19:05Z
From: Rui Barradas
Subject: weighted averages for two variables
Hello,
Thanks.
The revised 'by' I had posted works with me.
An alternative, more complicated, is using split/sapply.
sapply(split(allspecies, allspecies$Year), function(x)
weighted.mean(x$Depth, x$CPUE))
Rui Barradas