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