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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Sep 1 20:40:38 CEST 2009


Author: jarioksa
Date: 2009-09-01 20:40:38 +0200 (Tue, 01 Sep 2009)
New Revision: 978

Modified:
   pkg/vegan/R/as.mlm.cca.R
   pkg/vegan/R/as.mlm.rda.R
   pkg/vegan/inst/ChangeLog
Log:
as.mlm works with cca/rda with na.actin = na.exclude

Modified: pkg/vegan/R/as.mlm.cca.R
===================================================================
--- pkg/vegan/R/as.mlm.cca.R	2009-09-01 18:29:25 UTC (rev 977)
+++ pkg/vegan/R/as.mlm.cca.R	2009-09-01 18:40:38 UTC (rev 978)
@@ -2,7 +2,9 @@
     function (x) 
 {
     w <- weights(x)
-    wa <- x$CCA$wa
+    k <- !is.na(w)
+    w <- w[k]
+    wa <- x$CCA$wa[k,]
     wa <- sweep(wa, 1, sqrt(w), "*")
     X <- qr.X(x$CCA$QR)
     colnames(X) <- colnames(X)[x$CCA$QR$pivot]

Modified: pkg/vegan/R/as.mlm.rda.R
===================================================================
--- pkg/vegan/R/as.mlm.rda.R	2009-09-01 18:29:25 UTC (rev 977)
+++ pkg/vegan/R/as.mlm.rda.R	2009-09-01 18:40:38 UTC (rev 978)
@@ -3,6 +3,8 @@
 {
     X <- qr.X(x$CCA$QR)
     colnames(X) <- colnames(X)[x$CCA$QR$pivot]
+    if (!is.null(x$na.action) && inherits(x$na.action, "exclude"))
+        x$CCA$wa <- x$CCA$wa[-x$na.action,]
     lm(x$CCA$wa ~ . - 1, data = as.data.frame(X))
 }
 

Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog	2009-09-01 18:29:25 UTC (rev 977)
+++ pkg/vegan/inst/ChangeLog	2009-09-01 18:40:38 UTC (rev 978)
@@ -4,6 +4,8 @@
 
 Version 1.16-27 (opened September 1, 2009)
 
+	* as.mlm.cca and as.mlm.rda work with na.action = na.exclude.
+
 	* permutest.cca and all anova.cca(..., by=) cases work with
 	na.action = na.exclude.
 



More information about the Vegan-commits mailing list