[Vegan-commits] r2049 - in pkg/vegan: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jan 20 13:06:31 CET 2012


Author: jarioksa
Date: 2012-01-20 13:06:30 +0100 (Fri, 20 Jan 2012)
New Revision: 2049

Modified:
   pkg/vegan/R/capscale.R
   pkg/vegan/inst/ChangeLog
Log:
do not return zero-row centroids in capscale

Modified: pkg/vegan/R/capscale.R
===================================================================
--- pkg/vegan/R/capscale.R	2012-01-18 11:19:13 UTC (rev 2048)
+++ pkg/vegan/R/capscale.R	2012-01-20 12:06:30 UTC (rev 2049)
@@ -147,6 +147,8 @@
         rs <- rowSums(sol$CCA$centroids^2)
         sol$CCA$centroids <- sol$CCA$centroids[rs > 1e-04, , 
                                                drop = FALSE]
+        if (nrow(sol$CCA$centroids) == 0)
+            sol$CCA$centroids <- NULL
     }
     sol$call <- match.call()
     sol$terms <- terms(formula, "Condition", data = data)

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2012-01-18 11:19:13 UTC (rev 2048)
+++ pkg/vegan/inst/ChangeLog	2012-01-20 12:06:30 UTC (rev 2049)
@@ -29,6 +29,13 @@
 
 	or in general if all marginal effects were aliased. 
 
+	* capscale: plotting failed for mod <- capscale(dune ~
+	Condition(Management) + A1, dune.env). The centroids for
+	Management were completely removed leaving a zero-row matrix of
+	centroids, and this caused an error in plot() and would probably
+	fail elsewhere.  The same problem can appear with completely
+	aliased classes, or when class centroids are nearly zero.
+
 	* ordistep: handle cases where the marginal effects for
 	adding/dropping are completely aliased. This should avoid problems
 	like that reported in



More information about the Vegan-commits mailing list