Skip to content

Commit 3e77fea

Browse files
committed
vegdist: more warnings on 'morisita': values < 1 not OK
Morisita uses terms x-1 which will become negative if x < 1.
1 parent 20ea493 commit 3e77fea

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

R/vegdist.R

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,13 @@
5656
warning("results may be meaningless with non-integer data in method ",
5757
dQuote(inm))
5858
if (method %in% 7) { # morisita
59+
if (any(x[x>0] < 1))
60+
warning("results may be meaningless with positive values < 1 in ",
61+
dQuote(inm))
5962
if (round(max(x)) == 1)
6063
warning("results may be meaningless with largest integer 1 in ",
6164
dQuote(inm))
62-
else if (any(r1 <- apply(x, 1, max) < 2))
65+
else if (any(r1 <- apply(x, 1, max) <= 1))
6366
warning(dQuote(inm),
6467
" expects some counts > 1, none in row(s) ",
6568
paste(which(r1), collapse=", "))

0 commit comments

Comments
 (0)