Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign updiveristy(): 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