[Vegan-commits] r2831 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Jan 10 18:07:08 CET 2014
Author: jarioksa
Date: 2014-01-10 18:07:08 +0100 (Fri, 10 Jan 2014)
New Revision: 2831
Modified:
pkg/vegan/R/cIndexKM.R
pkg/vegan/inst/ChangeLog
Log:
Calinski criterion for one class is now NA instead of Inf, -Inf or NaN
Modified: pkg/vegan/R/cIndexKM.R
===================================================================
--- pkg/vegan/R/cIndexKM.R 2014-01-10 11:03:26 UTC (rev 2830)
+++ pkg/vegan/R/cIndexKM.R 2014-01-10 17:07:08 UTC (rev 2831)
@@ -26,7 +26,11 @@
{
n <- sum(clsize)
k <- length(clsize)
- zgss$bgss/(k - 1)/(zgss$wgss/(n - k))
+ ## undefined 0/0 for one class (or fewer in error cases)
+ if (k <= 1)
+ NA
+ else
+ zgss$bgss/(k - 1)/(zgss$wgss/(n - k))
}
################################################
ssi <- function(centers, clsize)
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2014-01-10 11:03:26 UTC (rev 2830)
+++ pkg/vegan/inst/ChangeLog 2014-01-10 17:07:08 UTC (rev 2831)
@@ -11,6 +11,11 @@
be used in an incorrect context". The dots were added in r2765,
and now removed.
+ * cascadeKM: Calinski index for one group will now be NA instead
+ of randomly chosen Inf, -Inf or NaN which can cause confusion (see
+ http://stackoverflow.com/questions/21022848/r-produces-different-result-after-io-on-file
+
+
* ordiellipse: failed if all points were on a line. Now handles
these cases by drawing a line trhough the points, and issuing a
warning from chol(): "the matrix is either rank-deficient or
More information about the Vegan-commits
mailing list