[Vegan-commits] r1378 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Nov 21 18:45:49 CET 2010
Author: jarioksa
Date: 2010-11-21 18:45:48 +0100 (Sun, 21 Nov 2010)
New Revision: 1378
Modified:
pkg/vegan/R/as.mlm.cca.R
pkg/vegan/R/as.mlm.rda.R
pkg/vegan/R/intersetcor.R
pkg/vegan/inst/ChangeLog
Log:
circumvent bug with wrong column names in qr.X with pivoted qr
Modified: pkg/vegan/R/as.mlm.cca.R
===================================================================
--- pkg/vegan/R/as.mlm.cca.R 2010-11-18 07:51:23 UTC (rev 1377)
+++ pkg/vegan/R/as.mlm.cca.R 2010-11-21 17:45:48 UTC (rev 1378)
@@ -5,7 +5,10 @@
wa <- x$CCA$wa
wa <- sweep(wa, 1, sqrt(w), "*")
X <- qr.X(x$CCA$QR)
- colnames(X) <- colnames(X)[x$CCA$QR$pivot]
+ ## qr.X gives wrong column names now, and they are fixed here
+ ## (hopefully fixed in 2.12.1, but that's only a wish).
+ if (getRversion() <= "2.12.0")
+ colnames(X)[x$CCA$QR$pivot] <- colnames(X)
lm(wa ~ . - 1, data = as.data.frame(X))
}
Modified: pkg/vegan/R/as.mlm.rda.R
===================================================================
--- pkg/vegan/R/as.mlm.rda.R 2010-11-18 07:51:23 UTC (rev 1377)
+++ pkg/vegan/R/as.mlm.rda.R 2010-11-21 17:45:48 UTC (rev 1378)
@@ -2,7 +2,10 @@
function (x)
{
X <- qr.X(x$CCA$QR)
- colnames(X) <- colnames(X)[x$CCA$QR$pivot]
+ ## We hope that column names will be fixed in R 2.12.1 (but
+ ## perhaps in vain).
+ if (getRversion() <= "2.12.0")
+ colnames(X)[x$CCA$QR$pivot] <- colnames(X)
lm(x$CCA$wa ~ . - 1, data = as.data.frame(X))
}
Modified: pkg/vegan/R/intersetcor.R
===================================================================
--- pkg/vegan/R/intersetcor.R 2010-11-18 07:51:23 UTC (rev 1377)
+++ pkg/vegan/R/intersetcor.R 2010-11-21 17:45:48 UTC (rev 1378)
@@ -7,5 +7,9 @@
w <- object$rowsum
wa <- sweep(object$CCA$wa, 1, sqrt(w), "*")
}
- cor(qr.X(object$CCA$QR), wa)
+ X <- qr.X(object$CCA$QR)
+ ## current R (2.12.0) uses wrong column names in pivoted qr.X()
+ if (getRversion() <= "2.12.0")
+ colnames(X)[object$CCA$QR$pivot] <- colnames(X)
+ cor(X, wa)
}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2010-11-18 07:51:23 UTC (rev 1377)
+++ pkg/vegan/inst/ChangeLog 2010-11-21 17:45:48 UTC (rev 1378)
@@ -8,6 +8,10 @@
vegan. Mainly clean up and checking of functions intended for the
release.
+ * as.mlm.cca/rda and intersector: should get the pivoting of names
+ in qr.X() correct both in the current buggy R and hopefully fixed
+ next version 2.12.1.
+
* vif.cca: aliased terms must be removed when calculating
VIFs. Test case vif.cca(cca(dune ~ Manure + Management, dune.env))
should give decent values all below <100 (used to give magnitude
More information about the Vegan-commits
mailing list