My summarySE
output looks like this:
summary <- summarySE(df, measurevar = "Cover", groupvars = c("Year","Loc"))
Year Loc N Cover sd se ci
1 2010 1 104 0.10560533 0.2163059 0.02121054 0.04206610
2 2010 2 97 0.06513590 0.1505460 0.01528563 0.03034173
3 2010 3 48 0.12428977 0.2031627 0.02932401 0.05899230
4 2011 1 90 0.09785354 0.2184823 0.02303006 0.04576023
5 2011 2 88 0.04467975 0.1591636 0.01696690 0.03372355
6 2011 3 45 0.06313131 0.1494173 0.02227382 0.04488992
The problem is, because of the layout of my data frame I have had to include multiple rows for the same quadrat that I used during sampling, due to multiple species occupying the same quadrat.
E.g.
Quadrat_no. Year Site Cover
1 2010 1 10
2 2010 1 5
2 2010 1 6
3 2010 1 7 etc.
Therefore, R is summing all the values in Cover, and dividing it by (e.g. 104) to calculate the weighted mean (e.g. 0.105), rather than the true sample size.
Is it possible to change my dataframe, so that R recognises that multiple rows represent a single quadrat? Therefore, changing N seen in summarySE
.
Edit: I have since found on: https://cran.r-project.org/web/packages/Hmisc/Hmisc.pdf that I may be able to use normwt
, although I can't figure out how to implement it, since there are no examples.