[Vegan-commits] r992 - pkg/vegan/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Sep 6 08:17:36 CEST 2009


Author: jarioksa
Date: 2009-09-06 08:17:36 +0200 (Sun, 06 Sep 2009)
New Revision: 992

Modified:
   pkg/vegan/R/as.mlm.cca.R
   pkg/vegan/R/goodness.cca.R
   pkg/vegan/R/permutest.cca.R
Log:
weights.cca fixes: use internal weight objects when dealing with other internal objects, so that na.exclude won't interfere

Modified: pkg/vegan/R/as.mlm.cca.R
===================================================================
--- pkg/vegan/R/as.mlm.cca.R	2009-09-06 06:15:00 UTC (rev 991)
+++ pkg/vegan/R/as.mlm.cca.R	2009-09-06 06:17:36 UTC (rev 992)
@@ -1,7 +1,7 @@
 `as.mlm.cca` <-
     function (x) 
 {
-    w <- weights(x)
+    w <- x$rowsum
     wa <- x$CCA$wa
     wa <- sweep(wa, 1, sqrt(w), "*")
     X <- qr.X(x$CCA$QR)

Modified: pkg/vegan/R/goodness.cca.R
===================================================================
--- pkg/vegan/R/goodness.cca.R	2009-09-06 06:15:00 UTC (rev 991)
+++ pkg/vegan/R/goodness.cca.R	2009-09-06 06:17:36 UTC (rev 992)
@@ -10,7 +10,7 @@
         stop("model ", model, " is not available")
     statistic <- match.arg(statistic)
     display <- match.arg(display)
-    cs <- weights(object, display = display)
+    cs <- ifelse(display == "species", object$colsum, object$rowsum)
     if (display == "species") {
         if (is.null(object$CCA)) 
             Xbar <- object$CA$Xbar

Modified: pkg/vegan/R/permutest.cca.R
===================================================================
--- pkg/vegan/R/permutest.cca.R	2009-09-06 06:15:00 UTC (rev 991)
+++ pkg/vegan/R/permutest.cca.R	2009-09-06 06:17:36 UTC (rev 992)
@@ -34,7 +34,7 @@
     den <- numeric(permutations)
     Q <- x$CCA$QR
     if (isCCA) {
-        w <- weights(x, "sites")
+        w <- x$rowsum # works with any na.action, weights(x) won't
         X <- qr.X(Q, ncol=length(Q$pivot))
         X <- sweep(X, 1, sqrt(w), "/")
     }



More information about the Vegan-commits mailing list