-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with diversity() #292
Comments
I can't see any attached data. Have you investigated the problem the error message mentioned? Is there any negative value in your data? |
tidyrgcfield1.txt |
It seems that |
Thanks for the help. I checked the data set and I am not seeing anything cell of data with an empty space as you had mentioned. This data set was also gathered and separated using tidyr from an original data set that was formatted in a way that you mention. Is there no way to use diversity() on a data set structure the same way as the one I had attached previously? |
This was raised as a github issue #292: input contained character data and we tested against negative entries with x < 0, which was true for empty string " " < 0. Try with diversity(dune.env).
Initially this started as a response to github issue #292: a user had messy tidyverse data instead of clean data, and assumed diversity() would work on that. However, when such messy data were transformed to a matrix, it was all promoted to character, and diversity failed. Such messy data are becoming more common because of tidyverse that mixes various non-data variables with clean data. The error message was very confusing: diversity() detected "negative data", because it used comparison x < 0, and this is TRUE for " " < 0 or characters with initial blanks. Now we check that data are numeric after as.matrix(). In the same process, I also checked several other functions using dune.env data with factor variables, and fixed those functions that silently accepted such data and gave misleading results, and those that gave similar confusing error messages. In this process, I also streamlined vegdist() that uses now less time in its R code.
issue #284 may be a duplicate of this issue. |
Hi,
I'm attempting to run shannon diversity index on the attached data files but I am getting the error "Error in diversity(tidyrgcfield1, index = "shannon") :
input data must be non-negative"
Help would be appreciated. Data file is attached.
I tried deleting contents of cell A1 that I had seen in a previous thread on the site but no luck.
Thanks in advance!
The text was updated successfully, but these errors were encountered: