[Vegan-commits] r2785 - in pkg/permute: R inst man tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Dec 1 00:32:45 CET 2013


Author: gsimpson
Date: 2013-12-01 00:32:45 +0100 (Sun, 01 Dec 2013)
New Revision: 2785

Modified:
   pkg/permute/R/numPerms.R
   pkg/permute/inst/ChangeLog
   pkg/permute/inst/TODO.md
   pkg/permute/man/shuffleSet.Rd
   pkg/permute/tests/Examples/permute-Ex.Rout.save
Log:
fix a bug in 'numPerms' which was ignoring the 'constant' setting when there were plots and within plot, samples ere freely permuted.

Modified: pkg/permute/R/numPerms.R
===================================================================
--- pkg/permute/R/numPerms.R	2013-11-30 22:17:01 UTC (rev 2784)
+++ pkg/permute/R/numPerms.R	2013-11-30 23:32:45 UTC (rev 2785)
@@ -131,7 +131,11 @@
         1
     } else if(isTRUE(all.equal(typeW, "free"))) {
         if(!is.null(PSTRATA)) {
-            prod(factorial(tab))
+            if(constantW) {
+                factorial(tab[1])
+            } else {
+                prod(factorial(tab))
+            }
         } else {
             exp(lfactorial(n))
         }

Modified: pkg/permute/inst/ChangeLog
===================================================================
--- pkg/permute/inst/ChangeLog	2013-11-30 22:17:01 UTC (rev 2784)
+++ pkg/permute/inst/ChangeLog	2013-11-30 23:32:45 UTC (rev 2785)
@@ -17,6 +17,9 @@
 	* allPerms: fix a bug where the blocks of permutations were being
 	recombined in the wrong way, by rows instead of by columns.
 
+	* numPerms: was ignoring the `constant` setting if free permutations
+	within level of plots.
+
 Version 0.7-8
 
 	* how, Plots: enforces that `blocks` and `strata` are factors, or

Modified: pkg/permute/inst/TODO.md
===================================================================
--- pkg/permute/inst/TODO.md	2013-11-30 22:17:01 UTC (rev 2784)
+++ pkg/permute/inst/TODO.md	2013-11-30 23:32:45 UTC (rev 2785)
@@ -47,7 +47,7 @@
     a `call` component and hence can be `update()`ed, hence the nested 
     calls to `update()`.
          
- * `permControl` - deprecate this in favour of `how` as in "how to
+ * `permControl` - deprecate this in favour of `how` as in "how to 
    permute"? *DONE Completed in 0.7-4*
 
  * `permuplot` - this may be fundamentally bust - it only worked in the
@@ -75,6 +75,10 @@
                     within = Within(type = "free", constant = TRUE))
         shuffleSet(20, 10, CTRL)
 
+    *DONE in 0.8-0*
+
  * Write an Rd page for the `"permutationMatrix"` S3 class where I can 
    describe the object returned by `shuffleSet()` and the methods 
    available for it.
+
+    *DONE in 0.7-8*
\ No newline at end of file

Modified: pkg/permute/man/shuffleSet.Rd
===================================================================
--- pkg/permute/man/shuffleSet.Rd	2013-11-30 22:17:01 UTC (rev 2784)
+++ pkg/permute/man/shuffleSet.Rd	2013-11-30 23:32:45 UTC (rev 2785)
@@ -112,10 +112,12 @@
 plotStrata <- Plots(strata = gl(4,5))
 CTRL <- how(plots = plotStrata,
             within = Within(type = "free"))
+numPerms(20, control = CTRL)
 shuffleSet(20, 10, control = CTRL)
 ## as above but same random permutation within Plot-level strata
 CTRL <- how(plots = plotStrata,
             within = Within(type = "free", constant = TRUE))
+numPerms(20, control = CTRL)
 shuffleSet(20, 10, CTRL) ## check this.
 
 ## time series within each level of Plot strata

Modified: pkg/permute/tests/Examples/permute-Ex.Rout.save
===================================================================
--- pkg/permute/tests/Examples/permute-Ex.Rout.save	2013-11-30 22:17:01 UTC (rev 2784)
+++ pkg/permute/tests/Examples/permute-Ex.Rout.save	2013-11-30 23:32:45 UTC (rev 2785)
@@ -1086,6 +1086,8 @@
 > plotStrata <- Plots(strata = gl(4,5))
 > CTRL <- how(plots = plotStrata,
 +             within = Within(type = "free"))
+> numPerms(20, control = CTRL)
+[1] 207360000
 > shuffleSet(20, 10, control = CTRL)
 No. of Permutations: 10
 No. of Samples: 20 (Nested in: plots; Randomised)
@@ -1116,6 +1118,8 @@
 > ## as above but same random permutation within Plot-level strata
 > CTRL <- how(plots = plotStrata,
 +             within = Within(type = "free", constant = TRUE))
+> numPerms(20, control = CTRL)
+[1] 120
 > shuffleSet(20, 10, CTRL) ## check this.
 No. of Permutations: 10
 No. of Samples: 20 (Nested in: plots; Randomised; same permutation in
@@ -1203,7 +1207,7 @@
 > ###
 > options(digits = 7L)
 > base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
-Time elapsed:  2.227 0.035 2.282 0 0 
+Time elapsed:  2.288 0.038 2.347 0 0 
 > grDevices::dev.off()
 null device 
           1 



More information about the Vegan-commits mailing list