Hi All,
I'm really new to R and have figured out some basics. But I'm struggling to find a way to select only portions of my data to calculate summary statistics on. My data has approximately 250000 specimens which are divided into 6 size classes. I would like to be able to calculate for example the mean weight for each size class within each location separately. I thought I was on track with this code:
library(plyr)
ddply(Sandy_Point_collapsed, .(spsize), summarise, spweight=mean(spweight))
but the output was:
spsize spweight
1 1 0.4336955
2 2 0.4336955
3 3 0.4336955
4 4 0.4336955
5 5 0.4336955
6 6 0.4336955
so it looks like is is giving me a value for each size class but it's just repeating the mean for the entire dataset each time.
any suggestions would be greatly appreciated!