[Vegan-commits] r268 - branches/1.11-0/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Mar 19 15:19:28 CET 2008


Author: gsimpson
Date: 2008-03-19 15:19:28 +0100 (Wed, 19 Mar 2008)
New Revision: 268

Modified:
   branches/1.11-0/R/numPerms.R
   branches/1.11-0/R/permuted.index2.R
Log:
merging bugfixes r265 and r266 from trunk to 1.11-0 branch

Modified: branches/1.11-0/R/numPerms.R
===================================================================
--- branches/1.11-0/R/numPerms.R	2008-03-19 13:39:15 UTC (rev 267)
+++ branches/1.11-0/R/numPerms.R	2008-03-19 14:19:28 UTC (rev 268)
@@ -42,7 +42,7 @@
                 nobs
         }
     } else if(control$type == "strata") {
-        exp(lfactorial(length(levels(control$strata)))) * unique(tab.strata)
+        exp(lfactorial(length(levels(control$strata))))
     } else {
         stop("Ambiguous permutation type in 'control$type'")
     }

Modified: branches/1.11-0/R/permuted.index2.R
===================================================================
--- branches/1.11-0/R/permuted.index2.R	2008-03-19 13:39:15 UTC (rev 267)
+++ branches/1.11-0/R/permuted.index2.R	2008-03-19 14:19:28 UTC (rev 268)
@@ -6,7 +6,8 @@
         {
             lev <- length(levels(strata))
             ngr <- length(strata) / lev
-            rep(sample(lev), ngr) + (rep(seq(0, ngr-1), each = lev) * lev)
+            sp <- split(seq(along = strata), strata)
+            unname(do.call(c, sp[.Internal(sample(lev, lev, FALSE, NULL))]))
         }
     `permuted.grid` <-
         function(nrow, ncol, mirror = FALSE, start.row = NULL, start.col = NULL)



More information about the Vegan-commits mailing list