Displaying 1 result from an estimated 1 matches for "allspeci".
Did you mean:
allspecies
2012 May 19
4
weighted averages for two variables
...ltiple variables and i'm trying to weigh average
depths for fish species per year by their abundance (CPUE. I have tried the
weighted.mean function but as i have two columns for the x value the lenghts
differ with the w (CPUE). How do I solve this problem?
So far I have tried this:
data<-by(allspecies, list(allspecies$Depth, allspecies$Year),
function(allspecies)weighted.mean(allspecies$CPUE))
but this doesn't seem to give the proper values, as the CPUE values are
included. I also have many NA's. When i try to exclude those all my values
change.
Thanks for your help!
much appreciated...