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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jan 17 13:18:46 CET 2011


Author: jarioksa
Date: 2011-01-17 13:18:46 +0100 (Mon, 17 Jan 2011)
New Revision: 1460

Modified:
   pkg/vegan/R/capscale.R
   pkg/vegan/inst/ChangeLog
Log:
subset and na.action in capscale

Modified: pkg/vegan/R/capscale.R
===================================================================
--- pkg/vegan/R/capscale.R	2011-01-17 09:03:28 UTC (rev 1459)
+++ pkg/vegan/R/capscale.R	2011-01-17 12:18:46 UTC (rev 1460)
@@ -50,14 +50,12 @@
                           envdepth = 1, na.action = na.action,
                           subset = substitute(subset))
     ## ordiParseFormula subsets rows of dissimilarities: do the same
-    ## for columns
+    ## for columns ('comm' is handled later)
     if (!is.null(d$subset))
         d$X <- d$X[, d$subset, drop = FALSE]
     ## Delete columns if rows were deleted due to missing values
     if (!is.null(d$na.action)) {
         d$X <- d$X[, -d$na.action, drop = FALSE]
-        if (!is.null(comm))
-            comm <- comm[-d$na.action,,drop=FALSE]
     }
     X <- as.dist(d$X)
     k <- attr(X, "Size") - 1
@@ -109,10 +107,13 @@
     }
     if (!is.null(comm)) {
         comm <- scale(comm, center = TRUE, scale = FALSE)
+        sol$colsum <- sd(comm)
         ## take a 'subset' of the community after scale()
         if (!is.null(d$subset))
             comm <- comm[d$subset, , drop = FALSE]
-        sol$colsum <- sd(comm)
+        ## NA action after 'subset'
+        if (!is.null(d$na.action))
+            comm <- comm[-d$na.action, , drop = FALSE]
         if (!is.null(sol$pCCA)) 
             comm <- qr.resid(sol$pCCA$QR, comm)
         if (!is.null(sol$CCA)) {

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2011-01-17 09:03:28 UTC (rev 1459)
+++ pkg/vegan/inst/ChangeLog	2011-01-17 12:18:46 UTC (rev 1460)
@@ -29,11 +29,10 @@
 	evaluated to a logical vector.
 
 	* capscale: implemented 'subset' (and this also works with
-	anova.cca). Still need to check in which order we have stepacross,
-	standardization, na.action etc and subset. However, currently it
-	looks like all anova.cca tests pass also with capscale (but more
-	thorough test will be run before closeing the anova.cca bug in
-	vegan-forge) 
+	anova.cca). It looks like all anova.cca tests pass also with
+	capscale (but more thorough test will be run before closeing the
+	anova.cca bug in vegan-forge). It seems that subset and na.action
+	also work. 
 
 Version 1.18-20 (closed January 9, 2011)
 



More information about the Vegan-commits mailing list