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
diveristy(): dealing with NA's #187
Comments
|
used to give diversity=0 if any observations were NA. Reported as issue #187 in github
@jarioksa Both changes sound useful, from a user point of view. If such checks slow this down to the extent that the negatively impact simulations it sounds like we need a |
|
Solved with commit 014b250. This commit also checks that data are non-negative. |
Hi,
I am very new to diversity/ecological statistical analysis (day 1 in fact!). Thank you for a very useful package and the documentation. A quick comment/observation (and given my lack of ecological experience I am not sure if this is a feature): Consider a data frame named thedf with counts of various species (captured as columns) where each row is a particular site, then
diversity(thedf)
will return the Shannon diversity measure, but a particular site on a particular day (i.e. a row of the df) might be lost/missing for some reason, i.e. the original data might be correctly coded as NA for that entire row in the data frame, but
diversity()
will returnapply( -x*xlog(x,exp(1), margin=1,sum,na.rm=TRUE)
where
x <- sweep(thedf, 1, total= apply(df,1,sum), "/")
i.e. 0 (zero)
Should diversity() not return a NA? Or should there not at least be a warning:
Thank you.
Jeremy
The text was updated successfully, but these errors were encountered: