[Vegan-commits] r999 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 9 16:54:43 CEST 2009
Author: jarioksa
Date: 2009-09-09 16:54:43 +0200 (Wed, 09 Sep 2009)
New Revision: 999
Modified:
pkg/vegan/R/predict.rda.R
pkg/vegan/inst/ChangeLog
Log:
predict.rda failed when rda() was based on correlations and there were missing species
Modified: pkg/vegan/R/predict.rda.R
===================================================================
--- pkg/vegan/R/predict.rda.R 2009-09-08 15:45:28 UTC (rev 998)
+++ pkg/vegan/R/predict.rda.R 2009-09-09 14:54:43 UTC (rev 999)
@@ -70,8 +70,10 @@
stop("No 'wa' scores available (yet) in partial RDA")
Xbar <- as.matrix(newdata)
Xbar <- sweep(Xbar, 2, cent, "-")
- if (!is.null(scal))
- Xbar <- sweep(Xbar, 2, scal, "/")
+ if (!is.null(scal)) {
+ nz <- scal > 0
+ Xbar[,nz] <- sweep(Xbar[,nz], 2, scal[nz], "/")
+ }
w <- Xbar %*% v
w <- sweep(w, 2, diag(slam), "/")
}
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2009-09-08 15:45:28 UTC (rev 998)
+++ pkg/vegan/inst/ChangeLog 2009-09-09 14:54:43 UTC (rev 999)
@@ -3,8 +3,10 @@
VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
Version 1.16-27 (opened September 1, 2009)
+
+ * predict.rda: failed when rda was based on correlations (scale =
+ TRUE), and there were missing data (0/0 division in scaling).
-
* cca & rda: New way of handling na.action. Function ordiNAexclude
adds items CCA$wa.excluded or CA$u.excluded for NA rows into
ordination result, and function ordiNApredict called in scores.cca
More information about the Vegan-commits
mailing list