I am trying to create a summary table in R with two grouping factors based on the following data
species plot type `mean(C)`
<fct> <fct> <fct> <dbl>
1 CA MI A -35.7
2 CA MI B -35.6
3 CA MI C -35.9
4 FO MI A -35.7
5 FO MI B -34.9
6 FO MI C -35.3
7 HE MI A -35.4
8 HE MI B -35.6
9 HE MI C -35.6
10 LA MI A -36.5
mean(C) is the response variable I am looking to show, and I'd like for it to be split up based on type and species; i.e. type as columns and species as rows
Every package I've tried to use (xtable, stargazer, gtsummary) doesn't seem to have the ability to do this. Of course, I can just plug and chug myself, but it'd be nice to know if there is a package. Anyone have any ideas?
Thanks so much
This is one solution using the tidyr:: package.
This returns: