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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Feb 28 14:06:47 CET 2010


Author: gsimpson
Date: 2010-02-28 14:06:47 +0100 (Sun, 28 Feb 2010)
New Revision: 1145

Modified:
   pkg/permute/R/numPerms.R
Log:
numPerms handles permuting strata only correctly now

Modified: pkg/permute/R/numPerms.R
===================================================================
--- pkg/permute/R/numPerms.R	2010-02-26 21:33:50 UTC (rev 1144)
+++ pkg/permute/R/numPerms.R	2010-02-28 13:06:47 UTC (rev 1145)
@@ -1,7 +1,7 @@
 `numPerms` <- function(object, control = permControl())
 {
     ## constant holding types where something is permuted
-    PTYPES <- c("free","grid","series")
+    PTYPES <- c("free","grid","series","none")
     ## expand object if a numeric or integer vector of length 1
     if((is.numeric(object) || is.integer(object)) &&
        (length(object) == 1))
@@ -61,7 +61,12 @@
     if(!(WITHIN$type %in% PTYPES))
         stop("Ambiguous permutation type in 'control$within$type'")
 
-    num.within <- if(WITHIN$type == "free") {
+    num.within <- if(WITHIN$type == "none") {
+        ## no within permutations
+        ## recall this is what we multiply num.blocks
+        ## by hence not 0
+        1
+    } else if(WITHIN$type == "free") {
         if(STRATA)
             prod(factorial(tab.strata))
         else



More information about the Vegan-commits mailing list