Hello, I have data on species in different state parks. There are four main columns: Region (categorical), Park (categorical), Nativeness (categorical), Organism (Categorical). The ultimate goal is to run a two way ANOVA on the dataset, but to do that I need to make the Nativeness category numeric according to park. In the end I want a number of native species for each park. I tried using
data$category <- as.numeric(data$category)
but that just turned all of the "natives" in the nativeness column into the same number rather than adding them up according to national park before turning the data into numeric.
Thanks for your help!
When you say turn the categorical into numerical, do you mean you want counts for each category? Or do you mean you want to use a number to represent the category?
To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:
So with this set, I want the program to sort the data so that I have this information (not in this format):
Park XXX has 3 native species, organisms AAA, CCC, CCC
Park ZZZ has one native, organism BBB
Park RRR has one native species, organism AAA
All Parks still have data on which organisms