[Vegan-commits] r995 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Sep 7 17:28:31 CEST 2009
Author: jarioksa
Date: 2009-09-07 17:28:29 +0200 (Mon, 07 Sep 2009)
New Revision: 995
Modified:
pkg/vegan/R/inertcomp.R
pkg/vegan/R/intersetcor.R
pkg/vegan/inst/ChangeLog
Log:
weights & scores fixes for cca/rda methods with na.action = na.exclude
Modified: pkg/vegan/R/inertcomp.R
===================================================================
--- pkg/vegan/R/inertcomp.R 2009-09-07 07:32:11 UTC (rev 994)
+++ pkg/vegan/R/inertcomp.R 2009-09-07 15:28:29 UTC (rev 995)
@@ -40,6 +40,10 @@
out <- cbind(pCCA, CCA, CA)
if (statistic == "distance" && !proportional) {
w <- weights(object, display = display)
+ if (display == "sites" &&
+ !is.null(object$na.action) &&
+ inherits(object$na.action, "exclude"))
+ w <- w[-object$na.action]
out <- sweep(out, 1, w, "/")
}
if (proportional)
Modified: pkg/vegan/R/intersetcor.R
===================================================================
--- pkg/vegan/R/intersetcor.R 2009-09-07 07:32:11 UTC (rev 994)
+++ pkg/vegan/R/intersetcor.R 2009-09-07 15:28:29 UTC (rev 995)
@@ -2,7 +2,10 @@
{
if (!inherits(object, "cca"))
stop("can be used only with objects inheriting from 'cca'")
- w <- weights(object)
- wa <- sweep(object$CCA$wa, 1, sqrt(w), "*")
+ wa <- object$CCA$wa
+ if (!inherits(object, "rda")) { # is CCA
+ w <- object$rowsum
+ wa <- sweep(object$CCA$wa, 1, sqrt(w), "*")
+ }
cor(qr.X(object$CCA$QR), wa)
}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2009-09-07 07:32:11 UTC (rev 994)
+++ pkg/vegan/inst/ChangeLog 2009-09-07 15:28:29 UTC (rev 995)
@@ -5,7 +5,7 @@
Version 1.16-27 (opened September 1, 2009)
* cca & rda: New way of handling na.action. Function ordiNAexclude
- in adds items CCA$wa.excluded or CA$u.excluded for NA rows into
+ adds items CCA$wa.excluded or CA$u.excluded for NA rows into
ordination result, and function ordiNApredict called in scores.cca
and scores.rda pads the results with these excluded data. In this
way the internal structure of the cca object remains unchanged,
@@ -15,10 +15,11 @@
* weights.cca and weights.rda know na.action.
* Fixing cca/rda functions for changes in weights(). The rule is
- that if you can match scores() and weights(), but if you have
+ that if you can mix scores() and weights(), but if you have
internal cca object stuctures (like x$CCA$u), you should have
internal weights x$rowsum. Concerns as.mlm.cca, goodness.cca,
- permutest.cca, spenvcor.
+ permutest.cca, spenvcor, inertcomp and intersetcor. (The inertcomp
+ solution is a kluge.)
* plot.cca: works when there are NA values in scores.
More information about the Vegan-commits
mailing list