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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jun 1 10:34:23 CEST 2010


Author: jarioksa
Date: 2010-06-01 10:34:23 +0200 (Tue, 01 Jun 2010)
New Revision: 1211

Modified:
   pkg/vegan/R/mantel.R
Log:
speed-up in mantel (and hence in mantel.correlog)

Modified: pkg/vegan/R/mantel.R
===================================================================
--- pkg/vegan/R/mantel.R	2010-06-01 08:22:35 UTC (rev 1210)
+++ pkg/vegan/R/mantel.R	2010-06-01 08:34:23 UTC (rev 1211)
@@ -10,10 +10,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])
             perm[i] <- cor(permvec, ydis, method = method)
         }
         signif <- (sum(perm >= statistic) + 1)/(permutations + 1)



More information about the Vegan-commits mailing list