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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 1 13:04:01 CEST 2010


Author: jarioksa
Date: 2010-06-01 13:04:01 +0200 (Tue, 01 Jun 2010)
New Revision: 1212

Modified:
   pkg/vegan/R/mantel.partial.R
Log:
similar speed-up in mantel.partial as in mantel

Modified: pkg/vegan/R/mantel.partial.R
===================================================================
--- pkg/vegan/R/mantel.partial.R	2010-06-01 08:34:23 UTC (rev 1211)
+++ pkg/vegan/R/mantel.partial.R	2010-06-01 11:04:01 UTC (rev 1212)
@@ -17,10 +17,10 @@
     if (permutations) {
         N <- attributes(xdis)$Size
         perm <- rep(0, permutations)
+        xmat <- as.matrix(xdis)
         for (i in 1:permutations) {
             take <- permuted.index(N, strata)
-            permvec <- as.vector(as.dist(as.matrix(xdis)[take, 
-                                                         take]))
+            permvec <- as.dist(xmat[take, take])
             rxy <- cor(permvec, ydis, method = method)
             rxz <- cor(permvec, zdis, method = method)
             perm[i] <- part.cor(rxy, rxz, ryz)



More information about the Vegan-commits mailing list