I've come to you with a question, please bear with me as I am pretty new to R in general.
Here is the problem:
I need to make a diversity index from a data table in R, and for this I found I could use the package "vegan".
Here is what I did:
simpson_diversity <- diversity(comT, index = "simpson")
where comT is the data frame with the data
Error in diversity(comT, index = "simpson") : input data must be numeric
Indeed, the data I am using contains observations of species written in the format "character"."character"
example: u.u j.k l.m
Is there a way I can use an other function to directly interpret the characters?
Otherwise, how can I encode the characters as numbers?
I have tried filtering the data frame by unique values with:
which gave /
yet I am not sure how to make these match to the original data frame.
Thank you for your help,