[Vegan-commits] r424 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Jun 12 17:16:23 CEST 2008


Author: psolymos
Date: 2008-06-12 17:16:23 +0200 (Thu, 12 Jun 2008)
New Revision: 424

Modified:
   pkg/R/permat.R
Log:
swap fixes (thin, and overwrite problen noticed by JO)


Modified: pkg/R/permat.R
===================================================================
--- pkg/R/permat.R	2008-06-12 05:33:59 UTC (rev 423)
+++ pkg/R/permat.R	2008-06-12 15:16:23 UTC (rev 424)
@@ -83,9 +83,9 @@
     if (count) for (k in 1:burnin) temp <- swapcount(temp)
         else for (k in 1:burnin) temp <- commsimulator(temp, method=method)
     for (i in 1:times)
-        if (count) perm[[i]][id,] <- swapcount(temp)
+        if (count) perm[[i]][id,] <- swapcount(temp, thin=thin)
         else perm[[i]][id,] <- commsimulator(temp, method=method, thin=thin)
-        }
+        temp <- perm[[i]][id,]}
     specs <- list(reg=reg, hab=hab, burnin=burnin, thin=thin)
     out <- list(call=match.call(), orig=m, perm=perm, specs=specs)
     attr(out, "mtype") <- mtype
@@ -142,7 +142,8 @@
         if (is.null(x$specs$reg) & !is.null(x$specs$hab)) int <- x$specs$hab
         if (!is.null(x$specs$reg) & !is.null(x$specs$hab))
             int <- interaction(x$specs$reg, x$specs$hab, drop=TRUE)
-        ssum <- numeric(n)}
+	nlev <- length(unique(int))        
+	ssum <- numeric(n)}
     bray <- psum <- pfill <- vrow <- vcol <- numeric(n)
     for (i in 1:n) {
         bray[i] <- sum(abs(x$orig-x$perm[[i]]))/sum(x$orig+x$perm[[i]])



More information about the Vegan-commits mailing list