[Vegan-commits] r2515 - pkg/permute/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 12 19:43:13 CEST 2013


Author: gsimpson
Date: 2013-06-12 19:43:12 +0200 (Wed, 12 Jun 2013)
New Revision: 2515

Modified:
   pkg/permute/R/allPerms.R
Log:
fix bug when different numbers of samples per Plot

Modified: pkg/permute/R/allPerms.R
===================================================================
--- pkg/permute/R/allPerms.R	2013-06-12 17:41:58 UTC (rev 2514)
+++ pkg/permute/R/allPerms.R	2013-06-12 17:43:12 UTC (rev 2515)
@@ -106,6 +106,8 @@
                 }
             } else {
                 ## different permutations within blocks
+                nperms <- numPerms(sum(tab), control)
+                
                 ng <- length(tab)
                 ##pg <- unique(tab)
                 if(length(pg) > 1) {
@@ -126,10 +128,10 @@
                         permW <- nrow(ord)
                         if(j == 1) {
                             a <- 1
-                            b <- np / permW
+                            b <- nperms / np
                         } else {
-                            b <- b/permW
-                            a <- np / (b*permW)
+                            b <- b / np
+                            a <- nperms / (b * np)
                         }
                         res[[j]] <- matrix(rep(repMat(ord+add[j], a),
                                                each = b),



More information about the Vegan-commits mailing list