[Vegan-commits] r2737 - in pkg/permute: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 21 19:04:39 CET 2013


Author: gsimpson
Date: 2013-11-21 19:04:39 +0100 (Thu, 21 Nov 2013)
New Revision: 2737

Modified:
   pkg/permute/R/Plots.R
   pkg/permute/R/how.R
   pkg/permute/inst/ChangeLog
   pkg/permute/man/how.Rd
Log:
enforce that 'blocks' and 'strata' are factors.

Modified: pkg/permute/R/Plots.R
===================================================================
--- pkg/permute/R/Plots.R	2013-11-21 18:03:56 UTC (rev 2736)
+++ pkg/permute/R/Plots.R	2013-11-21 18:04:39 UTC (rev 2737)
@@ -2,6 +2,9 @@
                     mirror = FALSE, ncol = NULL, nrow = NULL) {
 
     plots.name <- deparse(substitute(strata))
+    ## strata should also be a factor - coerce
+    if(!is.null(strata))
+        strata <- as.factor(strata)
 
     type <- match.arg(type)
 

Modified: pkg/permute/R/how.R
===================================================================
--- pkg/permute/R/how.R	2013-11-21 18:03:56 UTC (rev 2736)
+++ pkg/permute/R/how.R	2013-11-21 18:04:39 UTC (rev 2737)
@@ -10,6 +10,9 @@
                   observed = FALSE) {
 
     blocks.name <- deparse(substitute(blocks))
+    ## blocks should also be a factor - coerce
+    if(!is.null(blocks))
+        blocks <- as.factor(blocks)
 
     ## process the call to make it standalone
     .call <- match.call()

Modified: pkg/permute/inst/ChangeLog
===================================================================
--- pkg/permute/inst/ChangeLog	2013-11-21 18:03:56 UTC (rev 2736)
+++ pkg/permute/inst/ChangeLog	2013-11-21 18:04:39 UTC (rev 2737)
@@ -2,6 +2,11 @@
 
 permute ChangeLog
 
+Version 0.7-8
+
+	* how, Plots: enforces that `blocks` and `strata` are factors, or
+	can be coerced to a factor via `as.factor()`, if specified.
+
 Version 0.7-7
 
 	* shuffleSet: Implemented an idea of Jari's to allow `check()` and
@@ -117,15 +122,15 @@
 	* allPerms, doAllPerms: now correctly work in presence of blocks,
 	and where there are no plots.
 
-	`allPerms` now includes the permutation design (its `control`
-	argument) as an attribute, `"control"`, on the returned matrix of
-	permutations.
+	  `allPerms` now includes the permutation design (its `control`
+	  argument) as an attribute, `"control"`, on the returned matrix of
+	  permutations.
 
-	`allPerms` looses arguments `max` and `observed` as these are
-	supposed to be in the control object created by `how()`.
+	  `allPerms` loses arguments `max` and `observed` as these are
+	  supposed to be in the control object created by `how()`.
 
-	`summary.allPerms` (its `print` method, more correctly) now prints
-	the permutation design alongside the set of permutations.
+	  `summary.allPerms` (its `print` method, more correctly) now prints
+	  the permutation design alongside the set of permutations.
 
 	* get-methods: new extractor functions `getObserved()` and
 	`getMake()` return the `observed` and `make` components of object
@@ -135,7 +140,7 @@
 	the `"how"` object. Use `getMinperm()` to extract the component
 	no-longer returned by `getComplete()`.
 
-	* check: function looses arguments `make.all` and `observed` as
+	* check: function loses arguments `make.all` and `observed` as
 	these are in the control object returned by `how()`.
 
 	The logic of some of the checks has been tweaked slightly.
@@ -232,7 +237,7 @@
 Version 0.7-1
 
 	* allPerms: implement Doug Bates version which simplifies and
-	speeds up the code. A faste RcppEigen-based version also exists
+	speeds up the code. A fast RcppEigen-based version also exists
 	but will need larger changes to the package to implement.
 
 Version 0.7-0

Modified: pkg/permute/man/how.Rd
===================================================================
--- pkg/permute/man/how.Rd	2013-11-21 18:03:56 UTC (rev 2736)
+++ pkg/permute/man/how.Rd	2013-11-21 18:04:39 UTC (rev 2737)
@@ -33,8 +33,9 @@
     themselves, or for the definition of blocking structures which
     further restrict permutations (\code{blocks}). \code{within} and
     \code{plots} each require a named list as produced by \code{Within}
-    and \code{Plots} respectively. \code{blocks} takes a factor, the
-    levels of which define the blocking structure.}
+    and \code{Plots} respectively. \code{blocks} takes a factor (or an
+    object coercible to a factor via \code{as.factor}), the levels of
+    which define the blocking structure.}
   \item{nperm}{numeric; the number of permutations.}
   \item{complete}{logical; should complete enumeration of all
     permutations be performed?}
@@ -61,8 +62,8 @@
   \item{mirror}{logical; should mirroring of sequences be allowed?}
   \item{ncol, nrow}{numeric; the number of columns and rows of samples
     in the spatial grid respectively.}
-  \item{strata}{An integer vector or factor specifying the strata for
-    permutation.}
+  \item{strata}{A factor, or an object that can be coerced to a factor
+    via \code{as.factor}, specifying the strata for permutation.} 
 }
 \details{
   \code{shuffle} can generate permutations for a wide range of



More information about the Vegan-commits mailing list