[Vegan-commits] r2503 - in pkg/vegan: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri May 24 09:02:13 CEST 2013
Author: jarioksa
Date: 2013-05-24 09:02:13 +0200 (Fri, 24 May 2013)
New Revision: 2503
Modified:
pkg/vegan/R/bioenv.default.R
pkg/vegan/inst/ChangeLog
Log:
bioenv passes ... to cor() like documented
Modified: pkg/vegan/R/bioenv.default.R
===================================================================
--- pkg/vegan/R/bioenv.default.R 2013-05-13 07:44:33 UTC (rev 2502)
+++ pkg/vegan/R/bioenv.default.R 2013-05-24 07:02:13 UTC (rev 2503)
@@ -10,14 +10,14 @@
if (any(sapply(env, is.factor)) && metric != "gower")
stop("you have factors in 'env': only 'metric = \"gower\"' is allowed")
if (is.null(partial)) {
- corfun <- function(dx, dy, dz, method) {
- cor(dx, dy, method=method)
+ corfun <- function(dx, dy, dz, method, ...) {
+ cor(dx, dy, method=method, ...)
}
} else {
- corfun <- function(dx, dy, dz, method) {
- rxy <- cor(dx, dy, method=method)
- rxz <- cor(dx, dz, method=method)
- ryz <- cor(dy, dz, method=method)
+ corfun <- function(dx, dy, dz, method, ...) {
+ rxy <- cor(dx, dy, method=method, ...)
+ rxz <- cor(dx, dz, method=method, ...)
+ ryz <- cor(dy, dz, method=method, ...)
(rxy - rxz*ryz)/sqrt(1-rxz*rxz)/sqrt(1-ryz*ryz)
}
}
@@ -103,17 +103,17 @@
est <- unlist(mclapply(1:nrow(sets), function(j)
corfun(comdis,
distfun(x[,sets[j,],drop = FALSE]),
- partial, method = method),
+ partial, method = method, ...),
mc.cores = parallel))
} else {
est <- parSapply(parallel, 1:nrow(sets), function(j)
corfun(comdis, distfun(x[,sets[j,],drop = FALSE]),
- partial, method = method))
+ partial, method = method, ...))
}
} else {
est <- sapply(1:nrow(sets), function(j)
corfun(comdis, distfun(x[,sets[j,], drop=FALSE ]),
- partial, method = method))
+ partial, method = method, ...))
}
best[[i]] <- list(best = sets[which.max(est), ], est = max(est))
if (trace) {
Modified: pkg/vegan/inst/ChangeLog
===================================================================
--- pkg/vegan/inst/ChangeLog 2013-05-13 07:44:33 UTC (rev 2502)
+++ pkg/vegan/inst/ChangeLog 2013-05-24 07:02:13 UTC (rev 2503)
@@ -11,11 +11,12 @@
also handle factor variables. This involves adding internal
function veganMahatrans() for Mahalanobis transformation. The
change was triggered by a recent email by Lydia Beaudrot (UC
- Davis) to implement Mahalanobis distances, and in the same I
- also implemented Robby Marotte's suggestion of using Gower
- distances (vegan Forum item in R-Forge in July 2012). The output
- is changed to show the 'metric' and the name of the 'method' is
- fully expanded. No more fails if 'upto' is too large.
+ Davis) to implement Mahalanobis distances, and in the same I also
+ implemented Robby Marotte's suggestion of using Gower distances
+ (vegan Forum item in R-Forge in July 2012). The output is changed
+ to show the 'metric' and the name of the 'method' is fully
+ expanded. No more fails if 'upto' is too large. Passes "..." to
+ cor() like documented, but never done.
* rankindex: can now use Mahalanobis or Manhattan
distances. Scales automatically gradient variables to unit
More information about the Vegan-commits
mailing list