I am trying to create a figure and in order to do that I need to group certain categories together while maintaining certain columns.
Here is an example of my data:
plot species species_group tally_95 tally_19
ba11 A. rubrum acer 937.5 625.0
ba11 A. saccharum acer 312.5 837.2
ba11 Q. alba quercus 312.5 1250.4
ba11 Fraxinus sp. fraxinus 0.0 1875.1
ba12 A. rubrum acer 312.5 3437.5
ba12 A. arborea shade_tol 625.0 1562.5
ba12 C. canadensis shade_tol 2500.0 5000.0
ba13 S. albidum sassafras 3750.0 2812.5
This is what I would like my data to look like:
species_group tally_95 tally_19
acer 1562.5 4899.7
quercus 312.5 1250.4
fraxinus 0.0 1875.1
shade_tol 3125.0 6562.5
sassafras 3750.0 2812.5
I just want to be able to group by species_group across all of my plots. I've tried aggregate() but it only uses numerical variables. Any help would be much appreciated!