I am working on a two-way repeated measure anova using the rstatix package.
library(rstatix)
res.aov <- anova_test(data=kolding, dv=count, wid=id, within=treatment)
get_anova_table(res.aov)
And here's how the data looks like:
id treatment species count
1 K1 biohut Goldsinny Wrasse 0
2 K2 biohut Goldsinny Wrasse 2
3 K3 biohut Goldsinny Wrasse 1
4 K4 biohut Goldsinny Wrasse 1
5 K5 biohut Goldsinny Wrasse 1
6 K6 biohut Goldsinny Wrasse 0
7 K1 biohut Atlantic Cod 0
8 K2 biohut Atlantic Cod 0
9 K3 biohut Atlantic Cod 1
10 K4 biohut Atlantic Cod 1
11 K5 biohut Atlantic Cod 0
...
I keep getting a spread error that each row of output must be identified by a unique combination of keys, and I don't know how to go about it.
I tried pivot_wider(), but it wouldn't budge.