New Upstream Snapshot - r-cran-permute

Ready changes

Summary

Merged new upstream version: 0.9-7+git20220127.1.b0717cd (was: 0.9-7).

Resulting package

Built on 2022-10-18T02:19 (took 16m36s)

The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:

apt install -t fresh-snapshots r-cran-permute

Diff

diff --git a/DESCRIPTION b/DESCRIPTION
index 36c35a0..3c4be18 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -21,12 +21,10 @@ BugReports: https://github.com/gavinsimpson/permute/issues
 Copyright: see file COPYRIGHTS
 VignetteBuilder: knitr
 NeedsCompilation: no
-Packaged: 2022-01-27 11:11:56 UTC; au690221
+Packaged: 2022-10-18 02:09:32 UTC; root
 Author: Gavin L. Simpson [aut, cph, cre]
     (<https://orcid.org/0000-0002-9084-8413>),
   R Core Team [cph],
   Douglas M. Bates [ctb],
   Jari Oksanen [ctb]
 Maintainer: Gavin L. Simpson <ucfagls@gmail.com>
-Repository: CRAN
-Date/Publication: 2022-01-27 11:50:02 UTC
diff --git a/MD5 b/MD5
deleted file mode 100644
index bd7d2d8..0000000
--- a/MD5
+++ /dev/null
@@ -1,74 +0,0 @@
-1131692d09f1ab6f5fc69d0a8f794f89 *DESCRIPTION
-449517ec91fe50b7198f2d4a2dc3b1c0 *NAMESPACE
-0d94016b600ddfd39087b8d41228ddb7 *R/Plots.R
-40da812fd0c1530aa117d1677f707023 *R/Within.R
-065086f18b59986e5feb8a6598b78632 *R/allFree.R
-af6ec0ff884e97781072c6db2cdeb61b *R/allGrid.R
-f49cdb032a5f59db0d6a66bcc3824af2 *R/allPerms.R
-ed8d66f8de2f14fdee5ee0b4d7ca450e *R/allSeries.R
-648a6fde01b25b284184dc1827c4264f *R/allStrata.R
-8ebbaea5c8da437515b487e1bdbdd8a7 *R/as.allPerms.R
-a76f0fdcb2d2f8c776f3846b3c41d26a *R/as.matrix.allPerms.R
-23435563d36be42bbd71da36581a78af *R/as.matrix.permutationMatrix.R
-0677bca1862f33eb1cc957d9d435a667 *R/blocks.R
-8776e79c375b73cb5da9a72d507a6310 *R/cbindAllPerms.R
-1fabf9c58cf0adeeb837f015ce8d2c98 *R/check.R
-b425906bbec143e8e99ecce43dddc2af *R/fixupCall.R
-dd6f1dc0f61fbb58c9e7ddd97b3a1802 *R/getFoo-methods.R
-253585e8aab94e4cec4dac4265591b35 *R/how.R
-408590a068e1f5def74a5d933f402a7f *R/nobs-methods.R
-4ecbcd7cf18cfcbfa6d232506ac8522b *R/numPerms.R
-b7ffedd8632192ce56b95b15d7c87107 *R/permute.R
-21a2adbee470ca86648b7ac0e9fd5d51 *R/print.allPerms.R
-4b69356047dd015dd5f7f1018b76bdfb *R/print.check.R
-d91d44308c82453d9d2466a70cc7157e *R/print.how.R
-ac687a3095ebd55719f7bb5eaf12b51d *R/print.permutationMatrix.R
-ad976cbddacaaaebd1e3b5a6f4eba771 *R/print.summary.allPerms.R
-eb6d20a84325371ed25f56333a1286f0 *R/print.summary.check.R
-b0287758362f6910d9afe7245ee5aa6d *R/setFoo-methods.R
-cd0032c147f285068ae00fe2ae9f66fd *R/shuffle-utils.R
-88046f4904c02b8b54b5c25e8ddcd399 *R/shuffle.R
-bf8dd5c1d0caa248fba46625bfe7d6ab *R/shuffleSet.R
-6c98b1afeb08eef934cc6d25557c8812 *R/summary.allPerms.R
-1452820ef3677a4cc68fc27837f67ee3 *R/summary.check.R
-33064923b08d1e65469449f32b0f2797 *R/update.Plots.R
-3a2a885a7705cee2fd97ecc1a7238b12 *R/update.how.R
-c3939356c2ef2cb8bf07368c3eaa3d0b *README.md
-058f68e57db85c5c0f24ea7f1170d046 *build/vignette.rds
-4d966dbdda958c863064462aeb589708 *data/jackal.rda
-aa947360198890f9a747920d52cf52c2 *inst/COPYRIGHTS
-350cf6f38f920edd803241ff236e1b3a *inst/ChangeLog
-0ffb35649d909a6e03cd50251c8f9931 *inst/NEWS
-bbb242b30032dba5f5a775dc43e91bf7 *inst/TODO.md
-b9ead84c35880c2245317ebe146a3b5a *inst/doc/permutations.R
-36c18de3e9298d405355409edbadfce9 *inst/doc/permutations.Rmd
-f0d43d175db0ff6d7b44daf179cb6fd4 *inst/doc/permutations.html
-330097c7d0f6ee57d25826bc4c1c64da *man/allPerms.Rd
-ae17a2363ef92ad5cfb7c9704b4fc130 *man/allUtils.Rd
-b73af948eaa9329248c324d6b56a171c *man/check.Rd
-dba0d68af8e965d9fbee421781f3852e *man/get-methods.Rd
-bdec9925952e0716cb736b54ef15f1d3 *man/how.Rd
-66c4ad89b8c8035bbc74ed3558e961bb *man/jackal.Rd
-d8b186ff64cd45411455e21c600e8c12 *man/nobs.Rd
-3101a045f667b06e45ce829b099d0ec8 *man/numPerms.Rd
-e69cb80138b5b21371a7a3719b610949 *man/set-methods.Rd
-33ea56ec78d2ce03a09c1058284c2533 *man/shuffle-utils.Rd
-852dc5dc6791fe1cc06b3f3e819c9885 *man/shuffle.Rd
-1ad33c01a3869c2ad0da09cbe5b5daed *man/shuffleSet.Rd
-3136389b201fea0bd764b9f30a91c2c9 *tests/Examples/permute-Ex.Rout.save
-08783b766dfc54380636442d03904b6d *tests/testthat.R
-2fc9b14557cea690969fccaa593b48a7 *tests/testthat/test-allPerms.R
-fe12f8d312fb93cd94e3bf6bc18c4f67 *tests/testthat/test-as-methods.R
-30070f3612c7b30f9c8cb625b6483fc9 *tests/testthat/test-blocks.R
-985bc4c319198c23ffcf50c86d22644e *tests/testthat/test-check.R
-8f50aefc98c44ddb9f8b8c3119703673 *tests/testthat/test-get-methods.R
-01077e2efc42c5837cfd2ba79a1508ef *tests/testthat/test-how.R
-39634017340df520ca0f6a43f5af12f1 *tests/testthat/test-nobs.R
-ae8b59b15b475c35de5708122c6d76ab *tests/testthat/test-numPerms.R
-300c4b5409a9464a382d2033aff83d36 *tests/testthat/test-permute-fun.R
-76b1d7cab5b4a9e789429ef6d1843c06 *tests/testthat/test-set-methods.R
-614c74c13b7c91eb0ed4ed47812020b7 *tests/testthat/test-shuffle-utils.R
-961cefc6d50a125f4536ce9b5a87a0ca *tests/testthat/test-shuffle.R
-5833438c67518df5202192b76f86c61a *tests/testthat/test-shuffleSet.R
-36c18de3e9298d405355409edbadfce9 *vignettes/permutations.Rmd
-04ffc25b51d75204407f0852dd597bf8 *vignettes/permute.bib
diff --git a/build/vignette.rds b/build/vignette.rds
index 5d5076d..9aaac98 100644
Binary files a/build/vignette.rds and b/build/vignette.rds differ
diff --git a/debian/changelog b/debian/changelog
index 6bc2312..4474944 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
-r-cran-permute (0.9-7-2) UNRELEASED; urgency=medium
+r-cran-permute (0.9-7+git20220127.1.b0717cd-1) UNRELEASED; urgency=medium
 
+  [ Andreas Tille ]
   * Disable reprotest
 
- -- Andreas Tille <tille@debian.org>  Sun, 13 Feb 2022 07:32:47 +0100
+  [ Debian Janitor ]
+  * New upstream snapshot.
+
+ -- Andreas Tille <tille@debian.org>  Tue, 18 Oct 2022 02:11:36 -0000
 
 r-cran-permute (0.9-7-1) unstable; urgency=medium
 
diff --git a/inst/doc/permutations.html b/inst/doc/permutations.html
index 9a76efa..4d41ab6 100644
--- a/inst/doc/permutations.html
+++ b/inst/doc/permutations.html
@@ -12,7 +12,7 @@
 
 <meta name="author" content="Gavin L. Simpson" />
 
-<meta name="date" content="2022-01-27" />
+<meta name="date" content="2022-10-18" />
 
 <title>Restricted permutations; using the permute package</title>
 
@@ -27,6 +27,7 @@
     </style>
 
 
+
 <style type="text/css">
   code {
     white-space: pre;
@@ -36,26 +37,28 @@
   }
 </style>
 <style type="text/css" data-origin="pandoc">
-a.sourceLine { display: inline-block; line-height: 1.25; }
-a.sourceLine { pointer-events: none; color: inherit; text-decoration: inherit; }
-a.sourceLine:empty { height: 1.2em; }
+pre > code.sourceCode { white-space: pre; position: relative; }
+pre > code.sourceCode > span { display: inline-block; line-height: 1.25; }
+pre > code.sourceCode > span:empty { height: 1.2em; }
 .sourceCode { overflow: visible; }
-code.sourceCode { white-space: pre; position: relative; }
+code.sourceCode > span { color: inherit; text-decoration: inherit; }
 div.sourceCode { margin: 1em 0; }
 pre.sourceCode { margin: 0; }
 @media screen {
 div.sourceCode { overflow: auto; }
 }
 @media print {
-code.sourceCode { white-space: pre-wrap; }
-a.sourceLine { text-indent: -1em; padding-left: 1em; }
-}
-pre.numberSource a.sourceLine
-  { position: relative; left: -4em; }
-pre.numberSource a.sourceLine::before
-  { content: attr(title);
+pre > code.sourceCode { white-space: pre-wrap; }
+pre > code.sourceCode > span { text-indent: -5em; padding-left: 5em; }
+}
+pre.numberSource code
+  { counter-reset: source-line 0; }
+pre.numberSource code > span
+  { position: relative; left: -4em; counter-increment: source-line; }
+pre.numberSource code > span > a:first-child::before
+  { content: counter(source-line);
     position: relative; left: -1em; text-align: right; vertical-align: baseline;
-    border: none; pointer-events: all; display: inline-block;
+    border: none; display: inline-block;
     -webkit-touch-callout: none; -webkit-user-select: none;
     -khtml-user-select: none; -moz-user-select: none;
     -ms-user-select: none; user-select: none;
@@ -64,15 +67,15 @@ pre.numberSource a.sourceLine::before
   }
 pre.numberSource { margin-left: 3em; border-left: 1px solid #aaaaaa;  padding-left: 4px; }
 div.sourceCode
-  {  }
+  {   }
 @media screen {
-a.sourceLine::before { text-decoration: underline; }
+pre > code.sourceCode > span > a:first-child::before { text-decoration: underline; }
 }
 code span.al { color: #ff0000; font-weight: bold; } /* Alert */
 code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
 code span.at { color: #7d9029; } /* Attribute */
 code span.bn { color: #40a070; } /* BaseN */
-code span.bu { } /* BuiltIn */
+code span.bu { color: #008000; } /* BuiltIn */
 code span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
 code span.ch { color: #4070a0; } /* Char */
 code span.cn { color: #880000; } /* Constant */
@@ -85,7 +88,7 @@ code span.er { color: #ff0000; font-weight: bold; } /* Error */
 code span.ex { } /* Extension */
 code span.fl { color: #40a070; } /* Float */
 code span.fu { color: #06287e; } /* Function */
-code span.im { } /* Import */
+code span.im { color: #008000; font-weight: bold; } /* Import */
 code span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */
 code span.kw { color: #007020; font-weight: bold; } /* Keyword */
 code span.op { color: #666666; } /* Operator */
@@ -106,13 +109,20 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
   for (var i = 0; i < sheets.length; i++) {
     if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
     try { var rules = sheets[i].cssRules; } catch (e) { continue; }
-    for (var j = 0; j < rules.length; j++) {
+    var j = 0;
+    while (j < rules.length) {
       var rule = rules[j];
       // check if there is a div.sourceCode rule
-      if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") continue;
+      if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") {
+        j++;
+        continue;
+      }
       var style = rule.style.cssText;
       // check if color or background-color is set
-      if (rule.style.color === '' && rule.style.backgroundColor === '') continue;
+      if (rule.style.color === '' && rule.style.backgroundColor === '') {
+        j++;
+        continue;
+      }
       // replace div.sourceCode by a pre.sourceCode rule
       sheets[i].deleteRule(j);
       sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
@@ -123,6 +133,28 @@ code span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warni
 
 
 
+<style type="text/css">
+/* for pandoc --citeproc since 2.11 */
+div.csl-bib-body { }
+div.csl-entry {
+  clear: both;
+}
+.hanging div.csl-entry {
+  margin-left:2em;
+  text-indent:-2em;
+}
+div.csl-left-margin {
+  min-width:2em;
+  float:left;
+}
+div.csl-right-inline {
+  margin-left:2em;
+  padding-left:1em;
+}
+div.csl-indent {
+  margin-left: 2em;
+}
+</style>
 
 <style type="text/css">body {
 background-color: #fff;
@@ -318,7 +350,7 @@ code > span.er { color: #a61717; background-color: #e3d2d2; }
 
 <h1 class="title toc-ignore">Restricted permutations; using the permute package</h1>
 <h4 class="author">Gavin L. Simpson</h4>
-<h4 class="date">2022-01-27</h4>
+<h4 class="date">2022-10-18</h4>
 
 
 
@@ -331,9 +363,9 @@ code > span.er { color: #a61717; background-color: #e3d2d2; }
 <div id="sec:simple" class="section level1">
 <h1>Simple randomisation</h1>
 <p>As an illustration of both randomisation and simple usage of the <em>permute</em> package we consider a small data set of mandible length measurements on specimens of the golden jackal (<em>Canis aureus</em>) from the British Museum of Natural History, London, UK. These data were collected as part of a study comparing prehistoric and modern canids <span class="citation">(Higham, Kijngam, and Manly 1980)</span>, and were analysed by <span class="citation">Manly (2007)</span>. There are ten measurements of mandible length on both male and female specimens. The data are available in the <code>jackal</code> data frame supplied with <em>permute</em>.</p>
-<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="kw">library</span>(<span class="st">&quot;permute&quot;</span>)</a>
-<a class="sourceLine" id="cb1-2" title="2"><span class="kw">data</span>(jackal)</a>
-<a class="sourceLine" id="cb1-3" title="3">jackal</a></code></pre></div>
+<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(<span class="st">&quot;permute&quot;</span>)</span>
+<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">data</span>(jackal)</span>
+<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a>jackal</span></code></pre></div>
 <pre><code>##    Length    Sex
 ## 1     120   Male
 ## 2     107   Male
@@ -356,9 +388,9 @@ code > span.er { color: #a61717; background-color: #e3d2d2; }
 ## 19    111 Female
 ## 20    111 Female</code></pre>
 <p>The interest is whether there is a difference in the mean mandible length between male and female golden jackals. The null hypothesis is that there is zero difference in mandible length between the two sexes or that females have larger mandibles. The alternative hypothesis is that males have larger mandibles. The usual statistical test of this hypothesis is a one-sided <span class="math inline">\(t\)</span> test, which can be applied using <code>t.test()</code></p>
-<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb3-1" title="1">jack.t &lt;-<span class="st"> </span><span class="kw">t.test</span>(Length <span class="op">~</span><span class="st"> </span>Sex, <span class="dt">data =</span> jackal, <span class="dt">var.equal =</span> <span class="ot">TRUE</span>,</a>
-<a class="sourceLine" id="cb3-2" title="2">                 <span class="dt">alternative =</span> <span class="st">&quot;greater&quot;</span>)</a>
-<a class="sourceLine" id="cb3-3" title="3">jack.t</a></code></pre></div>
+<div class="sourceCode" id="cb3"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a>jack.t <span class="ot">&lt;-</span> <span class="fu">t.test</span>(Length <span class="sc">~</span> Sex, <span class="at">data =</span> jackal, <span class="at">var.equal =</span> <span class="cn">TRUE</span>,</span>
+<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a>                 <span class="at">alternative =</span> <span class="st">&quot;greater&quot;</span>)</span>
+<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a>jack.t</span></code></pre></div>
 <pre><code>## 
 ##  Two Sample t-test
 ## 
@@ -382,28 +414,28 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 <p>This assumption may be relaxed using <code>var.equal = FALSE</code> (the default) in the call to <code>t.test()</code>, to employ Welch’s modification for unequal variances. Assumption 3 may be valid, but with such a small sample we are unable to reliably test this.</p>
 <p>A randomisation test of the same hypothesis can be performed by randomly allocating ten of the mandible lengths to the male group and the remaining lengths to the female group. This randomisation is justified under the null hypothesis because the observed difference in mean mandible length between the two sexes is just a typical value for the difference in a sample if there were no difference in the population. An appropriate test statistic needs to be selected. We could use the <span class="math inline">\(t\)</span> statistic as derived in the <span class="math inline">\(t\)</span>-test. Alternatively, we could base our randomisation test on the difference of means <span class="math inline">\(D_i\)</span> (male - female).</p>
 <p>The main function in <em>permute</em> for providing random permutations is <code>shuffle()</code>. We can write our own randomisation test for the <code>jackal</code> data by first creating a function to compute the difference of means for two groups</p>
-<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1">meanDif &lt;-<span class="st"> </span><span class="cf">function</span>(x, grp) {</a>
-<a class="sourceLine" id="cb6-2" title="2"> <span class="kw">mean</span>(x[grp <span class="op">==</span><span class="st"> &quot;Male&quot;</span>]) <span class="op">-</span><span class="st"> </span><span class="kw">mean</span>(x[grp <span class="op">==</span><span class="st"> &quot;Female&quot;</span>])</a>
-<a class="sourceLine" id="cb6-3" title="3">}</a></code></pre></div>
+<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb6-1"><a href="#cb6-1" aria-hidden="true" tabindex="-1"></a>meanDif <span class="ot">&lt;-</span> <span class="cf">function</span>(x, grp) {</span>
+<span id="cb6-2"><a href="#cb6-2" aria-hidden="true" tabindex="-1"></a> <span class="fu">mean</span>(x[grp <span class="sc">==</span> <span class="st">&quot;Male&quot;</span>]) <span class="sc">-</span> <span class="fu">mean</span>(x[grp <span class="sc">==</span> <span class="st">&quot;Female&quot;</span>])</span>
+<span id="cb6-3"><a href="#cb6-3" aria-hidden="true" tabindex="-1"></a>}</span></code></pre></div>
 <p>which can be used in a simple <code>for()</code> loop to generate the null distribution for the difference of means. First, we allocate some storage to hold the null difference of means; here we use 4999 random permutations so allocate a vector of length 5000. Then we iterate, randomly generating an ordering of the <code>Sex</code> vector and computing the difference of means for that permutation.</p>
-<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">Djackal &lt;-<span class="st"> </span><span class="kw">numeric</span>(<span class="dt">length =</span> <span class="dv">5000</span>)</a>
-<a class="sourceLine" id="cb7-2" title="2">N &lt;-<span class="st"> </span><span class="kw">nrow</span>(jackal)</a>
-<a class="sourceLine" id="cb7-3" title="3"><span class="kw">set.seed</span>(<span class="dv">42</span>)</a>
-<a class="sourceLine" id="cb7-4" title="4"><span class="cf">for</span>(i <span class="cf">in</span> <span class="kw">seq_len</span>(<span class="kw">length</span>(Djackal) <span class="op">-</span><span class="st"> </span><span class="dv">1</span>)) {</a>
-<a class="sourceLine" id="cb7-5" title="5">    perm &lt;-<span class="st"> </span><span class="kw">shuffle</span>(N)</a>
-<a class="sourceLine" id="cb7-6" title="6">    Djackal[i] &lt;-<span class="st"> </span><span class="kw">with</span>(jackal, <span class="kw">meanDif</span>(Length, Sex[perm]))</a>
-<a class="sourceLine" id="cb7-7" title="7">}</a>
-<a class="sourceLine" id="cb7-8" title="8">Djackal[<span class="dv">5000</span>] &lt;-<span class="st"> </span><span class="kw">with</span>(jackal, <span class="kw">meanDif</span>(Length, Sex))</a></code></pre></div>
+<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb7-1"><a href="#cb7-1" aria-hidden="true" tabindex="-1"></a>Djackal <span class="ot">&lt;-</span> <span class="fu">numeric</span>(<span class="at">length =</span> <span class="dv">5000</span>)</span>
+<span id="cb7-2"><a href="#cb7-2" aria-hidden="true" tabindex="-1"></a>N <span class="ot">&lt;-</span> <span class="fu">nrow</span>(jackal)</span>
+<span id="cb7-3"><a href="#cb7-3" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">42</span>)</span>
+<span id="cb7-4"><a href="#cb7-4" aria-hidden="true" tabindex="-1"></a><span class="cf">for</span>(i <span class="cf">in</span> <span class="fu">seq_len</span>(<span class="fu">length</span>(Djackal) <span class="sc">-</span> <span class="dv">1</span>)) {</span>
+<span id="cb7-5"><a href="#cb7-5" aria-hidden="true" tabindex="-1"></a>    perm <span class="ot">&lt;-</span> <span class="fu">shuffle</span>(N)</span>
+<span id="cb7-6"><a href="#cb7-6" aria-hidden="true" tabindex="-1"></a>    Djackal[i] <span class="ot">&lt;-</span> <span class="fu">with</span>(jackal, <span class="fu">meanDif</span>(Length, Sex[perm]))</span>
+<span id="cb7-7"><a href="#cb7-7" aria-hidden="true" tabindex="-1"></a>}</span>
+<span id="cb7-8"><a href="#cb7-8" aria-hidden="true" tabindex="-1"></a>Djackal[<span class="dv">5000</span>] <span class="ot">&lt;-</span> <span class="fu">with</span>(jackal, <span class="fu">meanDif</span>(Length, Sex))</span></code></pre></div>
 <p>The observed difference of means was added to the null distribution, because under the null hypothesis the observed allocation of mandible lengths to male and female jackals is just one of the possible random allocations.</p>
 <p>The null distribution of <span class="math inline">\(D_i\)</span> can be visualised using a histogram, as shown in Figure~@ref{draw_hist_jackal}. The observed difference of means (4.8) is indicated by the red tick mark.</p>
-<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1"><span class="kw">hist</span>(Djackal, <span class="dt">main =</span> <span class="st">&quot;&quot;</span>,</a>
-<a class="sourceLine" id="cb8-2" title="2">     <span class="dt">xlab =</span> <span class="kw">expression</span>(<span class="st">&quot;Mean difference (Male - Female) in mm&quot;</span>))</a>
-<a class="sourceLine" id="cb8-3" title="3"><span class="kw">rug</span>(Djackal[<span class="dv">5000</span>], <span class="dt">col =</span> <span class="st">&quot;red&quot;</span>, <span class="dt">lwd =</span> <span class="dv">2</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb8-1"><a href="#cb8-1" aria-hidden="true" tabindex="-1"></a><span class="fu">hist</span>(Djackal, <span class="at">main =</span> <span class="st">&quot;&quot;</span>,</span>
+<span id="cb8-2"><a href="#cb8-2" aria-hidden="true" tabindex="-1"></a>     <span class="at">xlab =</span> <span class="fu">expression</span>(<span class="st">&quot;Mean difference (Male - Female) in mm&quot;</span>))</span>
+<span id="cb8-3"><a href="#cb8-3" aria-hidden="true" tabindex="-1"></a><span class="fu">rug</span>(Djackal[<span class="dv">5000</span>], <span class="at">col =</span> <span class="st">&quot;red&quot;</span>, <span class="at">lwd =</span> <span class="dv">2</span>)</span></code></pre></div>
 <p>The number of values in the randomisation distribution equal to or larger than the observed difference is</p>
-<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb9-1" title="1">(Dbig &lt;-<span class="st"> </span><span class="kw">sum</span>(Djackal <span class="op">&gt;=</span><span class="st"> </span>Djackal[<span class="dv">5000</span>]))</a></code></pre></div>
+<div class="sourceCode" id="cb9"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb9-1"><a href="#cb9-1" aria-hidden="true" tabindex="-1"></a>(Dbig <span class="ot">&lt;-</span> <span class="fu">sum</span>(Djackal <span class="sc">&gt;=</span> Djackal[<span class="dv">5000</span>]))</span></code></pre></div>
 <pre><code>## [1] 12</code></pre>
 <p>giving a permutational <span class="math inline">\(p\)</span>-value of</p>
-<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb11-1" title="1">Dbig <span class="op">/</span><span class="st"> </span><span class="kw">length</span>(Djackal)</a></code></pre></div>
+<div class="sourceCode" id="cb11"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb11-1"><a href="#cb11-1" aria-hidden="true" tabindex="-1"></a>Dbig <span class="sc">/</span> <span class="fu">length</span>(Djackal)</span></code></pre></div>
 <pre><code>## [1] 0.0024</code></pre>
 <p>which is comparable with that determined from the frequentist <span class="math inline">\(t\)</span>-test, and indicates strong evidence against the null hypothesis of no difference.</p>
 <div class="figure">
@@ -413,7 +445,7 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 </p>
 </div>
 <p>In total there <span class="math inline">\(^{20}C_{10} = 184,756\)</span> possible allocations of the 20 observations to two groups of ten</p>
-<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb13-1" title="1"><span class="kw">choose</span>(<span class="dv">20</span>, <span class="dv">10</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb13"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb13-1"><a href="#cb13-1" aria-hidden="true" tabindex="-1"></a><span class="fu">choose</span>(<span class="dv">20</span>, <span class="dv">10</span>)</span></code></pre></div>
 <pre><code>## [1] 184756</code></pre>
 <p>so we have only evaluated a small proportion of these in the randomisation test.</p>
 <p>The main workhorse function we used above was <code>shuffle()</code>. In this example, we could have used the base R function <code>sample()</code> to generate the randomised indices <code>perm</code> that were used to permute the <code>Sex</code> factor. Where <code>shuffle()</code> comes into it’s own is for generating permutation indices from restricted permutation designs.</p>
@@ -426,11 +458,11 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 <li><code>n</code>, the number of observations in the data set to be permuted, and</li>
 <li><code>control</code>, a list that defines the permutation design describing how the samples should be permuted.</li>
 </ol>
-<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb15-1" title="1"><span class="kw">args</span>(shuffle)</a></code></pre></div>
+<div class="sourceCode" id="cb15"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb15-1"><a href="#cb15-1" aria-hidden="true" tabindex="-1"></a><span class="fu">args</span>(shuffle)</span></code></pre></div>
 <pre><code>## function (n, control = how()) 
 ## NULL</code></pre>
 <p>A series of convenience functions are provided that allow the user to set-up even quite complex permutation designs with little effort. The user only needs to specify the aspects of the design they require and the convenience functions ensure all configuration choices are set and passed on to <code>shuffle()</code>. The main convenience function is <code>how()</code>, which returns a list specifying all the options available for controlling the sorts of permutations returned by <code>shuffle()</code>.</p>
-<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb17-1" title="1"><span class="kw">str</span>(<span class="kw">how</span>())</a></code></pre></div>
+<div class="sourceCode" id="cb17"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb17-1"><a href="#cb17-1" aria-hidden="true" tabindex="-1"></a><span class="fu">str</span>(<span class="fu">how</span>())</span></code></pre></div>
 <pre><code>## List of 12
 ##  $ within     :List of 6
 ##   ..$ type    : chr &quot;free&quot;
@@ -461,13 +493,13 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 ##  $ call       : language how()
 ##  - attr(*, &quot;class&quot;)= chr &quot;how&quot;</code></pre>
 <p>The defaults describe a random permutation design where all objects are freely exchangeable. Using these defaults, <code>shuffle(10)</code> amounts to <code>sample(1:10, 10, replace = FALSE)</code>:</p>
-<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb19-1" title="1"><span class="kw">set.seed</span>(<span class="dv">2</span>)</a>
-<a class="sourceLine" id="cb19-2" title="2">(r1 &lt;-<span class="st"> </span><span class="kw">shuffle</span>(<span class="dv">10</span>))</a></code></pre></div>
+<div class="sourceCode" id="cb19"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb19-1"><a href="#cb19-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">2</span>)</span>
+<span id="cb19-2"><a href="#cb19-2" aria-hidden="true" tabindex="-1"></a>(r1 <span class="ot">&lt;-</span> <span class="fu">shuffle</span>(<span class="dv">10</span>))</span></code></pre></div>
 <pre><code>##  [1]  5  6  9  1 10  7  4  8  3  2</code></pre>
-<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb21-1" title="1"><span class="kw">set.seed</span>(<span class="dv">2</span>)</a>
-<a class="sourceLine" id="cb21-2" title="2">(r2 &lt;-<span class="st"> </span><span class="kw">sample</span>(<span class="dv">1</span><span class="op">:</span><span class="dv">10</span>, <span class="dv">10</span>, <span class="dt">replace =</span> <span class="ot">FALSE</span>))</a></code></pre></div>
+<div class="sourceCode" id="cb21"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb21-1"><a href="#cb21-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">2</span>)</span>
+<span id="cb21-2"><a href="#cb21-2" aria-hidden="true" tabindex="-1"></a>(r2 <span class="ot">&lt;-</span> <span class="fu">sample</span>(<span class="dv">1</span><span class="sc">:</span><span class="dv">10</span>, <span class="dv">10</span>, <span class="at">replace =</span> <span class="cn">FALSE</span>))</span></code></pre></div>
 <pre><code>##  [1]  5  6  9  1 10  7  4  8  3  2</code></pre>
-<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb23-1" title="1"><span class="kw">all.equal</span>(r1, r2)</a></code></pre></div>
+<div class="sourceCode" id="cb23"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb23-1"><a href="#cb23-1" aria-hidden="true" tabindex="-1"></a><span class="fu">all.equal</span>(r1, r2)</span></code></pre></div>
 <pre><code>## [1] TRUE</code></pre>
 <div id="generating-restricted-permutations" class="section level2">
 <h2>Generating restricted permutations</h2>
@@ -482,27 +514,27 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 <p>The first three of these can be nested within the levels of a factor or to the levels of that factor, or to both. Such flexibility allows the analysis of split-plot designs using permutation tests, especially when combined with blocks.</p>
 <p><code>how()</code> is used to set up the design from which <code>shuffle()</code> will draw a permutation. <code>how()</code> has two main arguments that specify how samples are permuted <em>within</em> plots of samples or at the plot level itself. These are <code>within</code> and <code>plots</code>. Two convenience functions, <code>Within()</code> and <code>Plots()</code> can be used to set the various options for permutation. Blocks operate at the uppermost level of this hierarchy; blocks define groups of plots, each of which may contain groups of samples.</p>
 <p>For example, to permute the observations <code>1:10</code> assuming a time series design for the entire set of observations, the following control object would be used</p>
-<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb25-1" title="1"><span class="kw">set.seed</span>(<span class="dv">4</span>)</a>
-<a class="sourceLine" id="cb25-2" title="2">x &lt;-<span class="st"> </span><span class="dv">1</span><span class="op">:</span><span class="dv">10</span></a>
-<a class="sourceLine" id="cb25-3" title="3">CTRL &lt;-<span class="st"> </span><span class="kw">how</span>(<span class="dt">within =</span> <span class="kw">Within</span>(<span class="dt">type =</span> <span class="st">&quot;series&quot;</span>))</a>
-<a class="sourceLine" id="cb25-4" title="4">perm &lt;-<span class="st"> </span><span class="kw">shuffle</span>(<span class="dv">10</span>, <span class="dt">control =</span> CTRL)</a>
-<a class="sourceLine" id="cb25-5" title="5">perm</a></code></pre></div>
+<div class="sourceCode" id="cb25"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb25-1"><a href="#cb25-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">4</span>)</span>
+<span id="cb25-2"><a href="#cb25-2" aria-hidden="true" tabindex="-1"></a>x <span class="ot">&lt;-</span> <span class="dv">1</span><span class="sc">:</span><span class="dv">10</span></span>
+<span id="cb25-3"><a href="#cb25-3" aria-hidden="true" tabindex="-1"></a>CTRL <span class="ot">&lt;-</span> <span class="fu">how</span>(<span class="at">within =</span> <span class="fu">Within</span>(<span class="at">type =</span> <span class="st">&quot;series&quot;</span>))</span>
+<span id="cb25-4"><a href="#cb25-4" aria-hidden="true" tabindex="-1"></a>perm <span class="ot">&lt;-</span> <span class="fu">shuffle</span>(<span class="dv">10</span>, <span class="at">control =</span> CTRL)</span>
+<span id="cb25-5"><a href="#cb25-5" aria-hidden="true" tabindex="-1"></a>perm</span></code></pre></div>
 <pre><code>##  [1]  9 10  1  2  3  4  5  6  7  8</code></pre>
-<div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb27-1" title="1">x[perm] <span class="co">## equivalent</span></a></code></pre></div>
+<div class="sourceCode" id="cb27"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb27-1"><a href="#cb27-1" aria-hidden="true" tabindex="-1"></a>x[perm] <span class="do">## equivalent</span></span></code></pre></div>
 <pre><code>##  [1]  9 10  1  2  3  4  5  6  7  8</code></pre>
 <p>It is assumed that the observations are in temporal or transect order. We only specified the type of permutation within plots, the remaining options were set to their defaults via <code>Within()</code>.</p>
 <p>A more complex design, with three plots, and a 3 by 3 spatial grid arrangement within each plot can be created as follows</p>
-<div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb29-1" title="1"><span class="kw">set.seed</span>(<span class="dv">4</span>)</a>
-<a class="sourceLine" id="cb29-2" title="2">plt &lt;-<span class="st"> </span><span class="kw">gl</span>(<span class="dv">3</span>, <span class="dv">9</span>)</a>
-<a class="sourceLine" id="cb29-3" title="3">CTRL &lt;-<span class="st"> </span><span class="kw">how</span>(<span class="dt">within =</span> <span class="kw">Within</span>(<span class="dt">type =</span> <span class="st">&quot;grid&quot;</span>, <span class="dt">ncol =</span> <span class="dv">3</span>, <span class="dt">nrow =</span> <span class="dv">3</span>),</a>
-<a class="sourceLine" id="cb29-4" title="4">            <span class="dt">plots =</span> <span class="kw">Plots</span>(<span class="dt">strata =</span> plt))</a>
-<a class="sourceLine" id="cb29-5" title="5">perm &lt;-<span class="st"> </span><span class="kw">shuffle</span>(<span class="kw">length</span>(plt), <span class="dt">control =</span> CTRL)</a>
-<a class="sourceLine" id="cb29-6" title="6">perm</a></code></pre></div>
+<div class="sourceCode" id="cb29"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb29-1"><a href="#cb29-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">4</span>)</span>
+<span id="cb29-2"><a href="#cb29-2" aria-hidden="true" tabindex="-1"></a>plt <span class="ot">&lt;-</span> <span class="fu">gl</span>(<span class="dv">3</span>, <span class="dv">9</span>)</span>
+<span id="cb29-3"><a href="#cb29-3" aria-hidden="true" tabindex="-1"></a>CTRL <span class="ot">&lt;-</span> <span class="fu">how</span>(<span class="at">within =</span> <span class="fu">Within</span>(<span class="at">type =</span> <span class="st">&quot;grid&quot;</span>, <span class="at">ncol =</span> <span class="dv">3</span>, <span class="at">nrow =</span> <span class="dv">3</span>),</span>
+<span id="cb29-4"><a href="#cb29-4" aria-hidden="true" tabindex="-1"></a>            <span class="at">plots =</span> <span class="fu">Plots</span>(<span class="at">strata =</span> plt))</span>
+<span id="cb29-5"><a href="#cb29-5" aria-hidden="true" tabindex="-1"></a>perm <span class="ot">&lt;-</span> <span class="fu">shuffle</span>(<span class="fu">length</span>(plt), <span class="at">control =</span> CTRL)</span>
+<span id="cb29-6"><a href="#cb29-6" aria-hidden="true" tabindex="-1"></a>perm</span></code></pre></div>
 <pre><code>##  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 25 26 27 19 20 21 22
 ## [26] 23 24</code></pre>
 <p>Visualising the permutation as the 3 matrices may help illustrate how the data have been shuffled</p>
-<div class="sourceCode" id="cb31"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb31-1" title="1"><span class="co">## Original</span></a>
-<a class="sourceLine" id="cb31-2" title="2"><span class="kw">lapply</span>(<span class="kw">split</span>(<span class="kw">seq_along</span>(plt), plt), matrix, <span class="dt">ncol =</span> <span class="dv">3</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb31"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb31-1"><a href="#cb31-1" aria-hidden="true" tabindex="-1"></a><span class="do">## Original</span></span>
+<span id="cb31-2"><a href="#cb31-2" aria-hidden="true" tabindex="-1"></a><span class="fu">lapply</span>(<span class="fu">split</span>(<span class="fu">seq_along</span>(plt), plt), matrix, <span class="at">ncol =</span> <span class="dv">3</span>)</span></code></pre></div>
 <pre><code>## $`1`
 ##      [,1] [,2] [,3]
 ## [1,]    1    4    7
@@ -520,8 +552,8 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 ## [1,]   19   22   25
 ## [2,]   20   23   26
 ## [3,]   21   24   27</code></pre>
-<div class="sourceCode" id="cb33"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb33-1" title="1"><span class="co">## Shuffled</span></a>
-<a class="sourceLine" id="cb33-2" title="2"><span class="kw">lapply</span>(<span class="kw">split</span>(perm, plt), matrix, <span class="dt">ncol =</span> <span class="dv">3</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb33"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb33-1"><a href="#cb33-1" aria-hidden="true" tabindex="-1"></a><span class="do">## Shuffled</span></span>
+<span id="cb33-2"><a href="#cb33-2" aria-hidden="true" tabindex="-1"></a><span class="fu">lapply</span>(<span class="fu">split</span>(perm, plt), matrix, <span class="at">ncol =</span> <span class="dv">3</span>)</span></code></pre></div>
 <pre><code>## $`1`
 ##      [,1] [,2] [,3]
 ## [1,]    1    4    7
@@ -541,12 +573,12 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 ## [3,]   27   21   24</code></pre>
 <p>In the first grid, the lower-left corner of the grid was set to row 2 and column 2 of the original, to row 1 and column 2 in the second grid, and to row 3 column 2 in the third grid.</p>
 <p>To have the same permutation within each level of <code>plt</code>, use the <code>constant</code> argument of the <code>Within()</code> function, setting it to <code>TRUE</code></p>
-<div class="sourceCode" id="cb35"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb35-1" title="1"><span class="kw">set.seed</span>(<span class="dv">4</span>)</a>
-<a class="sourceLine" id="cb35-2" title="2">CTRL &lt;-<span class="st"> </span><span class="kw">how</span>(<span class="dt">within =</span> <span class="kw">Within</span>(<span class="dt">type =</span> <span class="st">&quot;grid&quot;</span>, <span class="dt">ncol =</span> <span class="dv">3</span>, <span class="dt">nrow =</span> <span class="dv">3</span>,</a>
-<a class="sourceLine" id="cb35-3" title="3">                            <span class="dt">constant =</span> <span class="ot">TRUE</span>),</a>
-<a class="sourceLine" id="cb35-4" title="4">            <span class="dt">plots =</span> <span class="kw">Plots</span>(<span class="dt">strata =</span> plt))</a>
-<a class="sourceLine" id="cb35-5" title="5">perm2 &lt;-<span class="st"> </span><span class="kw">shuffle</span>(<span class="kw">length</span>(plt), <span class="dt">control =</span> CTRL)</a>
-<a class="sourceLine" id="cb35-6" title="6"><span class="kw">lapply</span>(<span class="kw">split</span>(perm2, plt), matrix, <span class="dt">ncol =</span> <span class="dv">3</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb35"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb35-1"><a href="#cb35-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">4</span>)</span>
+<span id="cb35-2"><a href="#cb35-2" aria-hidden="true" tabindex="-1"></a>CTRL <span class="ot">&lt;-</span> <span class="fu">how</span>(<span class="at">within =</span> <span class="fu">Within</span>(<span class="at">type =</span> <span class="st">&quot;grid&quot;</span>, <span class="at">ncol =</span> <span class="dv">3</span>, <span class="at">nrow =</span> <span class="dv">3</span>,</span>
+<span id="cb35-3"><a href="#cb35-3" aria-hidden="true" tabindex="-1"></a>                            <span class="at">constant =</span> <span class="cn">TRUE</span>),</span>
+<span id="cb35-4"><a href="#cb35-4" aria-hidden="true" tabindex="-1"></a>            <span class="at">plots =</span> <span class="fu">Plots</span>(<span class="at">strata =</span> plt))</span>
+<span id="cb35-5"><a href="#cb35-5" aria-hidden="true" tabindex="-1"></a>perm2 <span class="ot">&lt;-</span> <span class="fu">shuffle</span>(<span class="fu">length</span>(plt), <span class="at">control =</span> CTRL)</span>
+<span id="cb35-6"><a href="#cb35-6" aria-hidden="true" tabindex="-1"></a><span class="fu">lapply</span>(<span class="fu">split</span>(perm2, plt), matrix, <span class="at">ncol =</span> <span class="dv">3</span>)</span></code></pre></div>
 <pre><code>## $`1`
 ##      [,1] [,2] [,3]
 ## [1,]    1    4    7
@@ -569,13 +601,13 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 <h2>Generating sets of permutations with shuffleSet()</h2>
 <p>There are several reasons why one might wish to generate a set of <span class="math inline">\(n\)</span> permutations instead of repeatedly generating permutations one at a time. Interpreting the permutation design happens each time <code>shuffle()</code> is called. This is an unnecessary computational burden, especially if you want to perform tests with large numbers of permutations. Furthermore, having the set of permutations available allows for expedited use with other functions, they can be iterated over using <code>for</code> loops or the <code>apply</code> family of functions, and the set of permutations can be exported for use outside of R.</p>
 <p>The <code>shuffleSet()</code> function allows the generation of sets of permutations from any of the designs available in <em>permute</em>. <code>shuffleSet()</code> takes an additional argument to that of <code>shuffle()</code>, <code>nset</code>, which is the number of permutations required for the set. <code>nset</code> can be missing, in which case the number of permutations in the set is looked for in the object passed to <code>control</code>; using this, the desired number of permutations can be set at the time the design is created via the <code>nperm</code> argument of <code>how()</code>. For example,</p>
-<div class="sourceCode" id="cb37"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb37-1" title="1"><span class="kw">how</span>(<span class="dt">nperm =</span> <span class="dv">10</span>, <span class="dt">within =</span> <span class="kw">Within</span>(<span class="dt">type =</span> <span class="st">&quot;series&quot;</span>))</a></code></pre></div>
+<div class="sourceCode" id="cb37"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb37-1"><a href="#cb37-1" aria-hidden="true" tabindex="-1"></a><span class="fu">how</span>(<span class="at">nperm =</span> <span class="dv">10</span>, <span class="at">within =</span> <span class="fu">Within</span>(<span class="at">type =</span> <span class="st">&quot;series&quot;</span>))</span></code></pre></div>
 <p>Internally, <code>shuffle()</code> and <code>shuffleSet()</code> are very similar, with the major difference being that <code>shuffleSet()</code> arranges repeated calls to the workhorse permutation-generating functions, only incurring the overhead associated with interpreting the permutation design once. <code>shuffleSet()</code> returns a matrix where the rows represent different permutations in the set.</p>
 <p>As an illustration, consider again the simple time series example from earlier. Here I generate a set of 5 permutations from the design, with the results returned as a matrix</p>
-<div class="sourceCode" id="cb38"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb38-1" title="1"><span class="kw">set.seed</span>(<span class="dv">4</span>)</a>
-<a class="sourceLine" id="cb38-2" title="2">CTRL &lt;-<span class="st"> </span><span class="kw">how</span>(<span class="dt">within =</span> <span class="kw">Within</span>(<span class="dt">type =</span> <span class="st">&quot;series&quot;</span>))</a>
-<a class="sourceLine" id="cb38-3" title="3">pset &lt;-<span class="st"> </span><span class="kw">shuffleSet</span>(<span class="dv">10</span>, <span class="dt">nset =</span> <span class="dv">5</span>, <span class="dt">control =</span> CTRL)</a>
-<a class="sourceLine" id="cb38-4" title="4">pset</a></code></pre></div>
+<div class="sourceCode" id="cb38"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb38-1"><a href="#cb38-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">4</span>)</span>
+<span id="cb38-2"><a href="#cb38-2" aria-hidden="true" tabindex="-1"></a>CTRL <span class="ot">&lt;-</span> <span class="fu">how</span>(<span class="at">within =</span> <span class="fu">Within</span>(<span class="at">type =</span> <span class="st">&quot;series&quot;</span>))</span>
+<span id="cb38-3"><a href="#cb38-3" aria-hidden="true" tabindex="-1"></a>pset <span class="ot">&lt;-</span> <span class="fu">shuffleSet</span>(<span class="dv">10</span>, <span class="at">nset =</span> <span class="dv">5</span>, <span class="at">control =</span> CTRL)</span>
+<span id="cb38-4"><a href="#cb38-4" aria-hidden="true" tabindex="-1"></a>pset</span></code></pre></div>
 <pre><code>## No. of Permutations: 5
 ## No. of Samples: 10 (Sequence)
 ## 
@@ -594,7 +626,7 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 <div id="set-the-number-of-permutations" class="section level2">
 <h2>Set the number of permutations</h2>
 <p>It may be useful to specify the number of permutations required in a permutation test alongside the permutation design. This is done via the <code>nperm</code> argument, as seen earlier. If nothing else is specified</p>
-<div class="sourceCode" id="cb40"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb40-1" title="1"><span class="kw">how</span>(<span class="dt">nperm =</span> <span class="dv">999</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb40"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb40-1"><a href="#cb40-1" aria-hidden="true" tabindex="-1"></a><span class="fu">how</span>(<span class="at">nperm =</span> <span class="dv">999</span>)</span></code></pre></div>
 <p>would indicate 999 random permutations where the samples are all freely exchangeable.</p>
 <p>One advantage of using <code>nperm</code> is that <code>shuffleSet()</code> will use this if the <code>nset</code> argument is not specified. Additionally, <code>shuffleSet()</code> will check to see if the desired number of permutations is possible given the data and the requested design. This is done via the function <code>check()</code>, which is discussed later.</p>
 </div>
@@ -611,16 +643,20 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 ## NULL</code></pre>
 <dl>
 <dt><code>type</code></dt>
-<dd>controls how the samples at the lowest level are permuted. The default is to form unrestricted permutations via option <code>&quot;type&quot;</code>. Options <code>&quot;series&quot;</code> and <code>&quot;grid&quot;</code> form restricted permutations via cyclic or toroidal shifts, respectively. The former is useful for samples that are a time series or line-transect, whilst the latter is used for samples on a regular spatial grid. The final option, <code>&quot;none&quot;</code>, will result in the samples at the lowest level not being permuted at all. This option is only of practical use when there are plots within the permutation/experimental design[^As blocks are never permuted, using <code>type = &quot;none&quot;</code> at the <em>within</em> level is also of no practical use.].
+<dd>
+controls how the samples at the lowest level are permuted. The default is to form unrestricted permutations via option <code>&quot;type&quot;</code>. Options <code>&quot;series&quot;</code> and <code>&quot;grid&quot;</code> form restricted permutations via cyclic or toroidal shifts, respectively. The former is useful for samples that are a time series or line-transect, whilst the latter is used for samples on a regular spatial grid. The final option, <code>&quot;none&quot;</code>, will result in the samples at the lowest level not being permuted at all. This option is only of practical use when there are plots within the permutation/experimental design[^As blocks are never permuted, using <code>type = &quot;none&quot;</code> at the <em>within</em> level is also of no practical use.].
 </dd>
 <dt><code>constant</code></dt>
-<dd>this argument only has an effect when there are plots in the design[^Owing to the current implementation, whilst this option could also be useful when blocks to define groups of samples, it will not have any influence over how permutations are generated. As such, only use blocks for simple blocking structures and use plots if you require greater control of the permutations at the group (i.e. plot) level.]. <code>constant = TRUE</code> stipulates that each plot should have the same <em>within-plot</em> permutation. This is useful for example when you have time series of observations from several plots. If all plots were sampled at the same time points, it can be argued that at the plot level, the samples experienced the same <em>time</em> and hence the same permutation should be used within each plot.
+<dd>
+this argument only has an effect when there are plots in the design[^Owing to the current implementation, whilst this option could also be useful when blocks to define groups of samples, it will not have any influence over how permutations are generated. As such, only use blocks for simple blocking structures and use plots if you require greater control of the permutations at the group (i.e. plot) level.]. <code>constant = TRUE</code> stipulates that each plot should have the same <em>within-plot</em> permutation. This is useful for example when you have time series of observations from several plots. If all plots were sampled at the same time points, it can be argued that at the plot level, the samples experienced the same <em>time</em> and hence the same permutation should be used within each plot.
 </dd>
 <dt><code>mirror</code></dt>
-<dd>when <code>type</code> is <code>&quot;series&quot;</code> or <code>&quot;grid&quot;</code>, argument <code>&quot;mirror&quot;</code> controls whether permutations are taken from the mirror image of the observed ordering in space or time. Consider the sequence <code>1, 2, 3, 4</code>. The relationship between observations is also preserved if we reverse the original ordering to <code>4, 3, 2, 1</code> and generate permutations from both these orderings. This is what happens when <code>mirror = TRUE</code>. For time series, the reversed ordering <code>4, 3, 2, 1</code> would imply an influence of observation 4 on observation 3, which is implausible. For spatial grids or line transects, however, this is a sensible option, and can significantly increase the number of possible permutations[^Setting <code>mirror = TRUE</code> will double or quadruple the set of permutations for <code>&quot;series&quot;</code> or <code>&quot;grid&quot;</code> permutations, respectively, as long as there are more than two time points or columns in the grid.].
+<dd>
+when <code>type</code> is <code>&quot;series&quot;</code> or <code>&quot;grid&quot;</code>, argument <code>&quot;mirror&quot;</code> controls whether permutations are taken from the mirror image of the observed ordering in space or time. Consider the sequence <code>1, 2, 3, 4</code>. The relationship between observations is also preserved if we reverse the original ordering to <code>4, 3, 2, 1</code> and generate permutations from both these orderings. This is what happens when <code>mirror = TRUE</code>. For time series, the reversed ordering <code>4, 3, 2, 1</code> would imply an influence of observation 4 on observation 3, which is implausible. For spatial grids or line transects, however, this is a sensible option, and can significantly increase the number of possible permutations[^Setting <code>mirror = TRUE</code> will double or quadruple the set of permutations for <code>&quot;series&quot;</code> or <code>&quot;grid&quot;</code> permutations, respectively, as long as there are more than two time points or columns in the grid.].
 </dd>
 <dt><code>ncol</code>, <code>nrow</code></dt>
-<dd>define the dimensions of the spatial grid.
+<dd>
+define the dimensions of the spatial grid.
 </dd>
 </dl>
 <p>How <code>Within()</code> is used has already been encountered in earlier sections of this vignette; the function is used to supply a value to the <code>within</code> argument of <code>how()</code>. You may have noticed that all the arguments of <code>Within()</code> have default values? This means that the user need only supply a modified value for the arguments they wish to change. Also, arguments that are not relevant for the type of permutation stated are simply ignored; <code>nrow</code> and <code>ncol</code>, for example, could be set to any value without affecting the permutation design if <code>type != &quot;grid&quot;</code>[^No warnings are currently given if incompatible arguments are specified; they are ignored, but may show up in the printed output. This infelicity will be removed prior to <em>permute</em> version 1.0-0 being released.].</p>
@@ -630,7 +666,8 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 <p>Permutation of samples at the <em>plot</em> level is configured via the <code>Plots()</code> function. As with <code>Within()</code>, <code>Plots()</code> is supplied to the <code>plots</code> argument of <code>how()</code>. <code>Plots()</code> takes many of the same arguments as <code>Within()</code>, the two differences being <code>strata</code>, a factor variable that describes the grouping of samples at the <em>plot</em> level, and the absence of a <code>constant</code> argument. As the majority of arguments are similar between <code>Within()</code> and <code>Plots()</code>, I will not repeat the details again, and only describe the <code>strata</code> argument</p>
 <dl>
 <dt><code>strata</code></dt>
-<dd>a factor variable. <code>strata</code> describes the grouping of samples at the <em>plot</em> level, where samples from the same <em>plot</em> are take the same <em>level</em> of the factor.
+<dd>
+a factor variable. <code>strata</code> describes the grouping of samples at the <em>plot</em> level, where samples from the same <em>plot</em> are take the same <em>level</em> of the factor.
 </dd>
 </dl>
 <p>When a <em>plot</em>-level design is specified, samples are never permuted between <em>plots</em>, only within plots if they are permuted at all. Hence, the type of permutation <em>within</em> the <em>plots</em> is controlled by <code>Within()</code>. Note also that with <code>Plots()</code>, the way the individual <em>plots</em> are permuted can be from any one of the four basic permutation types; <code>&quot;none&quot;</code>, <code>&quot;free&quot;</code>, <code>&quot;series&quot;</code>, and <code>&quot;grid&quot;</code>, as described above. To permute the <em>plots</em> only (i.e. retain the ordering of the samples <em>within</em> plots), you also need to specify <code>Within(type = &quot;none&quot;, ...)</code> as the default in <code>Within()</code> is <code>type = &quot;free&quot;</code>. The ability to permute the plots whilst preserving the within-plot ordering is an impotant feature in testing explanatory factors at the whole-plot level in split-plot designs and in multifactorial analysis of variance <span class="citation">(Braak and Šmilauer 2012)</span>.</p>
@@ -652,77 +689,77 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 <p>In the previous sections, I described the various user-facing functions that are employed to set up permutation designs and generate permutations from these. Here I will outline how package authors can use functionality in the <em>permute</em> package to implement permutation tests.</p>
 <p>In Section~@ref{sec:simple} I showed how a permutation test function could be written using the <code>shuffle()</code> function and allowing the user to pass into the test function an object created with <code>how()</code>. As mentioned earlier, it is more efficient to generate a set of permutations via a call to <code>shuffleSet()</code> than to repeatedly call <code>shuffle()</code> and large number of times. Another advantage of using <code>shuffleSet()</code> is that once the set of permutations has been created, parallel processing can be used to break the set of permutations down into smaller chunks, each of which can be worked on simultaneously. As a result, package authors are encouraged to use <code>shuffleSet()</code> instead of the simpler <code>shuffle()</code>.</p>
 <p>To illustrate how to use <em>permute</em> in <em>R</em> functions, I’ll rework the permutation test I used for the <code>jackal</code> data earlier in Section~@ref{sec:simple}.</p>
-<div class="sourceCode" id="cb42"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb42-1" title="1">pt.test &lt;-<span class="st"> </span><span class="cf">function</span>(x, group, <span class="dt">nperm =</span> <span class="dv">199</span>) {</a>
-<a class="sourceLine" id="cb42-2" title="2">    <span class="co">## mean difference function</span></a>
-<a class="sourceLine" id="cb42-3" title="3">    meanDif &lt;-<span class="st"> </span><span class="cf">function</span>(i, x, grp) {</a>
-<a class="sourceLine" id="cb42-4" title="4">        grp &lt;-<span class="st"> </span>grp[i]</a>
-<a class="sourceLine" id="cb42-5" title="5">        <span class="kw">mean</span>(x[grp <span class="op">==</span><span class="st"> &quot;Male&quot;</span>]) <span class="op">-</span><span class="st"> </span><span class="kw">mean</span>(x[grp <span class="op">==</span><span class="st"> &quot;Female&quot;</span>])</a>
-<a class="sourceLine" id="cb42-6" title="6">    }</a>
-<a class="sourceLine" id="cb42-7" title="7">    <span class="co">## check x and group are of same length</span></a>
-<a class="sourceLine" id="cb42-8" title="8">    <span class="kw">stopifnot</span>(<span class="kw">all.equal</span>(<span class="kw">length</span>(x), <span class="kw">length</span>(group)))</a>
-<a class="sourceLine" id="cb42-9" title="9">    <span class="co">## number of observations</span></a>
-<a class="sourceLine" id="cb42-10" title="10">    N &lt;-<span class="st"> </span><span class="kw">nobs</span>(x)</a>
-<a class="sourceLine" id="cb42-11" title="11">    <span class="co">## generate the required set of permutations</span></a>
-<a class="sourceLine" id="cb42-12" title="12">    pset &lt;-<span class="st"> </span><span class="kw">shuffleSet</span>(N, <span class="dt">nset =</span> nperm)</a>
-<a class="sourceLine" id="cb42-13" title="13">    <span class="co">## iterate over the set of permutations applying meanDif</span></a>
-<a class="sourceLine" id="cb42-14" title="14">    D &lt;-<span class="st"> </span><span class="kw">apply</span>(pset, <span class="dv">1</span>, meanDif, <span class="dt">x =</span> x, <span class="dt">grp =</span> group)</a>
-<a class="sourceLine" id="cb42-15" title="15">    <span class="co">## add on the observed mean difference</span></a>
-<a class="sourceLine" id="cb42-16" title="16">    D &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="kw">meanDif</span>(<span class="kw">seq_len</span>(N), x, group), D)</a>
-<a class="sourceLine" id="cb42-17" title="17">    <span class="co">## compute &amp; return the p-value</span></a>
-<a class="sourceLine" id="cb42-18" title="18">    Ds &lt;-<span class="st"> </span><span class="kw">sum</span>(D <span class="op">&gt;=</span><span class="st"> </span>D[<span class="dv">1</span>]) <span class="co"># how many &gt;= to the observed diff?</span></a>
-<a class="sourceLine" id="cb42-19" title="19">    Ds <span class="op">/</span><span class="st"> </span>(nperm <span class="op">+</span><span class="st"> </span><span class="dv">1</span>)     <span class="co"># what proportion of perms is this (the pval)?</span></a>
-<a class="sourceLine" id="cb42-20" title="20">}</a></code></pre></div>
+<div class="sourceCode" id="cb42"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb42-1"><a href="#cb42-1" aria-hidden="true" tabindex="-1"></a>pt.test <span class="ot">&lt;-</span> <span class="cf">function</span>(x, group, <span class="at">nperm =</span> <span class="dv">199</span>) {</span>
+<span id="cb42-2"><a href="#cb42-2" aria-hidden="true" tabindex="-1"></a>    <span class="do">## mean difference function</span></span>
+<span id="cb42-3"><a href="#cb42-3" aria-hidden="true" tabindex="-1"></a>    meanDif <span class="ot">&lt;-</span> <span class="cf">function</span>(i, x, grp) {</span>
+<span id="cb42-4"><a href="#cb42-4" aria-hidden="true" tabindex="-1"></a>        grp <span class="ot">&lt;-</span> grp[i]</span>
+<span id="cb42-5"><a href="#cb42-5" aria-hidden="true" tabindex="-1"></a>        <span class="fu">mean</span>(x[grp <span class="sc">==</span> <span class="st">&quot;Male&quot;</span>]) <span class="sc">-</span> <span class="fu">mean</span>(x[grp <span class="sc">==</span> <span class="st">&quot;Female&quot;</span>])</span>
+<span id="cb42-6"><a href="#cb42-6" aria-hidden="true" tabindex="-1"></a>    }</span>
+<span id="cb42-7"><a href="#cb42-7" aria-hidden="true" tabindex="-1"></a>    <span class="do">## check x and group are of same length</span></span>
+<span id="cb42-8"><a href="#cb42-8" aria-hidden="true" tabindex="-1"></a>    <span class="fu">stopifnot</span>(<span class="fu">all.equal</span>(<span class="fu">length</span>(x), <span class="fu">length</span>(group)))</span>
+<span id="cb42-9"><a href="#cb42-9" aria-hidden="true" tabindex="-1"></a>    <span class="do">## number of observations</span></span>
+<span id="cb42-10"><a href="#cb42-10" aria-hidden="true" tabindex="-1"></a>    N <span class="ot">&lt;-</span> <span class="fu">nobs</span>(x)</span>
+<span id="cb42-11"><a href="#cb42-11" aria-hidden="true" tabindex="-1"></a>    <span class="do">## generate the required set of permutations</span></span>
+<span id="cb42-12"><a href="#cb42-12" aria-hidden="true" tabindex="-1"></a>    pset <span class="ot">&lt;-</span> <span class="fu">shuffleSet</span>(N, <span class="at">nset =</span> nperm)</span>
+<span id="cb42-13"><a href="#cb42-13" aria-hidden="true" tabindex="-1"></a>    <span class="do">## iterate over the set of permutations applying meanDif</span></span>
+<span id="cb42-14"><a href="#cb42-14" aria-hidden="true" tabindex="-1"></a>    D <span class="ot">&lt;-</span> <span class="fu">apply</span>(pset, <span class="dv">1</span>, meanDif, <span class="at">x =</span> x, <span class="at">grp =</span> group)</span>
+<span id="cb42-15"><a href="#cb42-15" aria-hidden="true" tabindex="-1"></a>    <span class="do">## add on the observed mean difference</span></span>
+<span id="cb42-16"><a href="#cb42-16" aria-hidden="true" tabindex="-1"></a>    D <span class="ot">&lt;-</span> <span class="fu">c</span>(<span class="fu">meanDif</span>(<span class="fu">seq_len</span>(N), x, group), D)</span>
+<span id="cb42-17"><a href="#cb42-17" aria-hidden="true" tabindex="-1"></a>    <span class="do">## compute &amp; return the p-value</span></span>
+<span id="cb42-18"><a href="#cb42-18" aria-hidden="true" tabindex="-1"></a>    Ds <span class="ot">&lt;-</span> <span class="fu">sum</span>(D <span class="sc">&gt;=</span> D[<span class="dv">1</span>]) <span class="co"># how many &gt;= to the observed diff?</span></span>
+<span id="cb42-19"><a href="#cb42-19" aria-hidden="true" tabindex="-1"></a>    Ds <span class="sc">/</span> (nperm <span class="sc">+</span> <span class="dv">1</span>)     <span class="co"># what proportion of perms is this (the pval)?</span></span>
+<span id="cb42-20"><a href="#cb42-20" aria-hidden="true" tabindex="-1"></a>}</span></code></pre></div>
 <p>The commented function should be reasonably self explanatory. I’ve altered the in-line version of the <code>meanDif()</code> function to take a vector of permutation indices <code>i</code> as the first argument, and internally the <code>grp</code> vector is permuted according to <code>i</code>. The other major change is that <code>shuffleSet()</code> is used to generate a set of permutations, which are then iterated over using <code>apply()</code>.</p>
 <p>In use we see</p>
-<div class="sourceCode" id="cb43"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb43-1" title="1"><span class="kw">set.seed</span>(<span class="dv">42</span>) <span class="co">## same seed as earlier</span></a>
-<a class="sourceLine" id="cb43-2" title="2">pval &lt;-<span class="st"> </span><span class="kw">with</span>(jackal, <span class="kw">pt.test</span>(Length, Sex, <span class="dt">nperm =</span> <span class="dv">4999</span>))</a>
-<a class="sourceLine" id="cb43-3" title="3">pval</a></code></pre></div>
+<div class="sourceCode" id="cb43"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb43-1"><a href="#cb43-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">42</span>) <span class="do">## same seed as earlier</span></span>
+<span id="cb43-2"><a href="#cb43-2" aria-hidden="true" tabindex="-1"></a>pval <span class="ot">&lt;-</span> <span class="fu">with</span>(jackal, <span class="fu">pt.test</span>(Length, Sex, <span class="at">nperm =</span> <span class="dv">4999</span>))</span>
+<span id="cb43-3"><a href="#cb43-3" aria-hidden="true" tabindex="-1"></a>pval</span></code></pre></div>
 <pre><code>## [1] 0.0024</code></pre>
 <p>which nicely agrees with the test we did earlier by hand.</p>
 <p>Iterating over a set of permutation indices also means that adding parallel processing of the permutations requires only trivial changes to the main function code. As an illustration, below I show a parallel version of <code>pt.test()</code></p>
-<div class="sourceCode" id="cb45"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb45-1" title="1">ppt.test &lt;-<span class="st"> </span><span class="cf">function</span>(x, group, <span class="dt">nperm =</span> <span class="dv">199</span>, <span class="dt">cores =</span> <span class="dv">2</span>) {</a>
-<a class="sourceLine" id="cb45-2" title="2">    <span class="co">## mean difference function</span></a>
-<a class="sourceLine" id="cb45-3" title="3">    meanDif &lt;-<span class="st"> </span><span class="cf">function</span>(i, .x, .grp) {</a>
-<a class="sourceLine" id="cb45-4" title="4">        .grp &lt;-<span class="st"> </span>.grp[i]</a>
-<a class="sourceLine" id="cb45-5" title="5">        <span class="kw">mean</span>(.x[.grp <span class="op">==</span><span class="st"> &quot;Male&quot;</span>]) <span class="op">-</span><span class="st"> </span><span class="kw">mean</span>(.x[.grp <span class="op">==</span><span class="st"> &quot;Female&quot;</span>])</a>
-<a class="sourceLine" id="cb45-6" title="6">    }</a>
-<a class="sourceLine" id="cb45-7" title="7">    <span class="co">## check x and group are of same length</span></a>
-<a class="sourceLine" id="cb45-8" title="8">    <span class="kw">stopifnot</span>(<span class="kw">all.equal</span>(<span class="kw">length</span>(x), <span class="kw">length</span>(group)))</a>
-<a class="sourceLine" id="cb45-9" title="9">    <span class="co">## number of observations</span></a>
-<a class="sourceLine" id="cb45-10" title="10">    N &lt;-<span class="st"> </span><span class="kw">nobs</span>(x)</a>
-<a class="sourceLine" id="cb45-11" title="11">    <span class="co">## generate the required set of permutations</span></a>
-<a class="sourceLine" id="cb45-12" title="12">    pset &lt;-<span class="st"> </span><span class="kw">shuffleSet</span>(N, <span class="dt">nset =</span> nperm)</a>
-<a class="sourceLine" id="cb45-13" title="13">    <span class="cf">if</span> (cores <span class="op">&gt;</span><span class="st"> </span><span class="dv">1</span>) {</a>
-<a class="sourceLine" id="cb45-14" title="14">        <span class="co">## initiate a cluster</span></a>
-<a class="sourceLine" id="cb45-15" title="15">        cl &lt;-<span class="st"> </span><span class="kw">makeCluster</span>(cores)</a>
-<a class="sourceLine" id="cb45-16" title="16">        <span class="kw">on.exit</span>(<span class="kw">stopCluster</span>(<span class="dt">cl =</span> cl))</a>
-<a class="sourceLine" id="cb45-17" title="17">        <span class="co">## iterate over the set of permutations applying meanDif</span></a>
-<a class="sourceLine" id="cb45-18" title="18">        D &lt;-<span class="st"> </span><span class="kw">parRapply</span>(cl, pset, meanDif, <span class="dt">.x =</span> x, <span class="dt">.grp =</span> group)</a>
-<a class="sourceLine" id="cb45-19" title="19">    } <span class="cf">else</span> {</a>
-<a class="sourceLine" id="cb45-20" title="20">        D &lt;-<span class="st"> </span><span class="kw">apply</span>(pset, <span class="dv">1</span>, meanDif, <span class="dt">.x =</span> x, <span class="dt">.grp =</span> group)</a>
-<a class="sourceLine" id="cb45-21" title="21">    }</a>
-<a class="sourceLine" id="cb45-22" title="22">    <span class="co">## add on the observed mean difference</span></a>
-<a class="sourceLine" id="cb45-23" title="23">    D &lt;-<span class="st"> </span><span class="kw">c</span>(<span class="kw">meanDif</span>(<span class="kw">seq_len</span>(N), x, group), D)</a>
-<a class="sourceLine" id="cb45-24" title="24">    <span class="co">## compute &amp; return the p-value</span></a>
-<a class="sourceLine" id="cb45-25" title="25">    Ds &lt;-<span class="st"> </span><span class="kw">sum</span>(D <span class="op">&gt;=</span><span class="st"> </span>D[<span class="dv">1</span>]) <span class="co"># how many &gt;= to the observed diff?</span></a>
-<a class="sourceLine" id="cb45-26" title="26">    Ds <span class="op">/</span><span class="st"> </span>(nperm <span class="op">+</span><span class="st"> </span><span class="dv">1</span>)     <span class="co"># what proportion of perms is this (the pval)?</span></a>
-<a class="sourceLine" id="cb45-27" title="27">}</a></code></pre></div>
+<div class="sourceCode" id="cb45"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb45-1"><a href="#cb45-1" aria-hidden="true" tabindex="-1"></a>ppt.test <span class="ot">&lt;-</span> <span class="cf">function</span>(x, group, <span class="at">nperm =</span> <span class="dv">199</span>, <span class="at">cores =</span> <span class="dv">2</span>) {</span>
+<span id="cb45-2"><a href="#cb45-2" aria-hidden="true" tabindex="-1"></a>    <span class="do">## mean difference function</span></span>
+<span id="cb45-3"><a href="#cb45-3" aria-hidden="true" tabindex="-1"></a>    meanDif <span class="ot">&lt;-</span> <span class="cf">function</span>(i, .x, .grp) {</span>
+<span id="cb45-4"><a href="#cb45-4" aria-hidden="true" tabindex="-1"></a>        .grp <span class="ot">&lt;-</span> .grp[i]</span>
+<span id="cb45-5"><a href="#cb45-5" aria-hidden="true" tabindex="-1"></a>        <span class="fu">mean</span>(.x[.grp <span class="sc">==</span> <span class="st">&quot;Male&quot;</span>]) <span class="sc">-</span> <span class="fu">mean</span>(.x[.grp <span class="sc">==</span> <span class="st">&quot;Female&quot;</span>])</span>
+<span id="cb45-6"><a href="#cb45-6" aria-hidden="true" tabindex="-1"></a>    }</span>
+<span id="cb45-7"><a href="#cb45-7" aria-hidden="true" tabindex="-1"></a>    <span class="do">## check x and group are of same length</span></span>
+<span id="cb45-8"><a href="#cb45-8" aria-hidden="true" tabindex="-1"></a>    <span class="fu">stopifnot</span>(<span class="fu">all.equal</span>(<span class="fu">length</span>(x), <span class="fu">length</span>(group)))</span>
+<span id="cb45-9"><a href="#cb45-9" aria-hidden="true" tabindex="-1"></a>    <span class="do">## number of observations</span></span>
+<span id="cb45-10"><a href="#cb45-10" aria-hidden="true" tabindex="-1"></a>    N <span class="ot">&lt;-</span> <span class="fu">nobs</span>(x)</span>
+<span id="cb45-11"><a href="#cb45-11" aria-hidden="true" tabindex="-1"></a>    <span class="do">## generate the required set of permutations</span></span>
+<span id="cb45-12"><a href="#cb45-12" aria-hidden="true" tabindex="-1"></a>    pset <span class="ot">&lt;-</span> <span class="fu">shuffleSet</span>(N, <span class="at">nset =</span> nperm)</span>
+<span id="cb45-13"><a href="#cb45-13" aria-hidden="true" tabindex="-1"></a>    <span class="cf">if</span> (cores <span class="sc">&gt;</span> <span class="dv">1</span>) {</span>
+<span id="cb45-14"><a href="#cb45-14" aria-hidden="true" tabindex="-1"></a>        <span class="do">## initiate a cluster</span></span>
+<span id="cb45-15"><a href="#cb45-15" aria-hidden="true" tabindex="-1"></a>        cl <span class="ot">&lt;-</span> <span class="fu">makeCluster</span>(cores)</span>
+<span id="cb45-16"><a href="#cb45-16" aria-hidden="true" tabindex="-1"></a>        <span class="fu">on.exit</span>(<span class="fu">stopCluster</span>(<span class="at">cl =</span> cl))</span>
+<span id="cb45-17"><a href="#cb45-17" aria-hidden="true" tabindex="-1"></a>        <span class="do">## iterate over the set of permutations applying meanDif</span></span>
+<span id="cb45-18"><a href="#cb45-18" aria-hidden="true" tabindex="-1"></a>        D <span class="ot">&lt;-</span> <span class="fu">parRapply</span>(cl, pset, meanDif, <span class="at">.x =</span> x, <span class="at">.grp =</span> group)</span>
+<span id="cb45-19"><a href="#cb45-19" aria-hidden="true" tabindex="-1"></a>    } <span class="cf">else</span> {</span>
+<span id="cb45-20"><a href="#cb45-20" aria-hidden="true" tabindex="-1"></a>        D <span class="ot">&lt;-</span> <span class="fu">apply</span>(pset, <span class="dv">1</span>, meanDif, <span class="at">.x =</span> x, <span class="at">.grp =</span> group)</span>
+<span id="cb45-21"><a href="#cb45-21" aria-hidden="true" tabindex="-1"></a>    }</span>
+<span id="cb45-22"><a href="#cb45-22" aria-hidden="true" tabindex="-1"></a>    <span class="do">## add on the observed mean difference</span></span>
+<span id="cb45-23"><a href="#cb45-23" aria-hidden="true" tabindex="-1"></a>    D <span class="ot">&lt;-</span> <span class="fu">c</span>(<span class="fu">meanDif</span>(<span class="fu">seq_len</span>(N), x, group), D)</span>
+<span id="cb45-24"><a href="#cb45-24" aria-hidden="true" tabindex="-1"></a>    <span class="do">## compute &amp; return the p-value</span></span>
+<span id="cb45-25"><a href="#cb45-25" aria-hidden="true" tabindex="-1"></a>    Ds <span class="ot">&lt;-</span> <span class="fu">sum</span>(D <span class="sc">&gt;=</span> D[<span class="dv">1</span>]) <span class="co"># how many &gt;= to the observed diff?</span></span>
+<span id="cb45-26"><a href="#cb45-26" aria-hidden="true" tabindex="-1"></a>    Ds <span class="sc">/</span> (nperm <span class="sc">+</span> <span class="dv">1</span>)     <span class="co"># what proportion of perms is this (the pval)?</span></span>
+<span id="cb45-27"><a href="#cb45-27" aria-hidden="true" tabindex="-1"></a>}</span></code></pre></div>
 <p>In use we observe</p>
-<div class="sourceCode" id="cb46"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb46-1" title="1"><span class="kw">require</span>(<span class="st">&quot;parallel&quot;</span>)</a>
-<a class="sourceLine" id="cb46-2" title="2"><span class="kw">set.seed</span>(<span class="dv">42</span>)</a>
-<a class="sourceLine" id="cb46-3" title="3"><span class="kw">system.time</span>(ppval &lt;-<span class="st"> </span><span class="kw">ppt.test</span>(jackal<span class="op">$</span>Length, jackal<span class="op">$</span>Sex, <span class="dt">nperm =</span> <span class="dv">9999</span>,</a>
-<a class="sourceLine" id="cb46-4" title="4">                              <span class="dt">cores =</span> <span class="dv">2</span>))</a></code></pre></div>
+<div class="sourceCode" id="cb46"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb46-1"><a href="#cb46-1" aria-hidden="true" tabindex="-1"></a><span class="fu">require</span>(<span class="st">&quot;parallel&quot;</span>)</span>
+<span id="cb46-2"><a href="#cb46-2" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">42</span>)</span>
+<span id="cb46-3"><a href="#cb46-3" aria-hidden="true" tabindex="-1"></a><span class="fu">system.time</span>(ppval <span class="ot">&lt;-</span> <span class="fu">ppt.test</span>(jackal<span class="sc">$</span>Length, jackal<span class="sc">$</span>Sex, <span class="at">nperm =</span> <span class="dv">9999</span>,</span>
+<span id="cb46-4"><a href="#cb46-4" aria-hidden="true" tabindex="-1"></a>                              <span class="at">cores =</span> <span class="dv">2</span>))</span></code></pre></div>
 <pre><code>##    user  system elapsed 
-##   0.069   0.000   0.286</code></pre>
-<div class="sourceCode" id="cb48"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb48-1" title="1">ppval</a></code></pre></div>
+##   0.222   0.020   0.847</code></pre>
+<div class="sourceCode" id="cb48"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb48-1"><a href="#cb48-1" aria-hidden="true" tabindex="-1"></a>ppval</span></code></pre></div>
 <pre><code>## [1] 0.0018</code></pre>
 <p>In this case there is little to be gained by splitting the computations over two CPU cores</p>
-<div class="sourceCode" id="cb50"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb50-1" title="1"><span class="kw">set.seed</span>(<span class="dv">42</span>)</a>
-<a class="sourceLine" id="cb50-2" title="2"><span class="kw">system.time</span>(ppval2 &lt;-<span class="st"> </span><span class="kw">ppt.test</span>(jackal<span class="op">$</span>Length, jackal<span class="op">$</span>Sex, <span class="dt">nperm =</span> <span class="dv">9999</span>,</a>
-<a class="sourceLine" id="cb50-3" title="3">                               <span class="dt">cores =</span> <span class="dv">1</span>))</a></code></pre></div>
+<div class="sourceCode" id="cb50"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb50-1"><a href="#cb50-1" aria-hidden="true" tabindex="-1"></a><span class="fu">set.seed</span>(<span class="dv">42</span>)</span>
+<span id="cb50-2"><a href="#cb50-2" aria-hidden="true" tabindex="-1"></a><span class="fu">system.time</span>(ppval2 <span class="ot">&lt;-</span> <span class="fu">ppt.test</span>(jackal<span class="sc">$</span>Length, jackal<span class="sc">$</span>Sex, <span class="at">nperm =</span> <span class="dv">9999</span>,</span>
+<span id="cb50-3"><a href="#cb50-3" aria-hidden="true" tabindex="-1"></a>                               <span class="at">cores =</span> <span class="dv">1</span>))</span></code></pre></div>
 <pre><code>##    user  system elapsed 
-##   0.225   0.004   0.229</code></pre>
-<div class="sourceCode" id="cb52"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb52-1" title="1">ppval2</a></code></pre></div>
+##   0.811   0.035   0.847</code></pre>
+<div class="sourceCode" id="cb52"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb52-1"><a href="#cb52-1" aria-hidden="true" tabindex="-1"></a>ppval2</span></code></pre></div>
 <pre><code>## [1] 0.0018</code></pre>
 <p>The cost of setting up and managing the parallel processes, and recombining the separate sets of results almost negates the gain in running the permutations in parallel. Here, the computations involved in <code>meanDif()</code> are trivial and we would expect greater efficiencies from running the permutations in parallel for more complex analyses.</p>
 <div id="accesing-and-changing-permutation-designs" class="section level2">
@@ -731,113 +768,136 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 <p>The <code>getFoo()</code> functions provided by <em>permute</em> are</p>
 <dl>
 <dt><code>getWithin()</code>, <code>getPlots()</code>, <code>getBlocks()</code></dt>
-<dd>these extract the details of the <em>within</em>-, <em>plots</em>-, and <em>blocks</em>-level components of the design. Given the current design (as of <em>permute</em> version 0.8-0), the first two of these return lists with classes <code>&quot;Within&quot;</code> and <code>&quot;Plots&quot;</code>, respectively, whilst <code>getBlocks()</code> returns the block-level factor.
+<dd>
+these extract the details of the <em>within</em>-, <em>plots</em>-, and <em>blocks</em>-level components of the design. Given the current design (as of <em>permute</em> version 0.8-0), the first two of these return lists with classes <code>&quot;Within&quot;</code> and <code>&quot;Plots&quot;</code>, respectively, whilst <code>getBlocks()</code> returns the block-level factor.
 </dd>
 <dt><code>getStrata()</code></dt>
-<dd>returns the factor describing the grouping of samples at the <em>plots</em> or <em>blocks</em> levels, as determined by the value of argument <code>which</code>.
+<dd>
+returns the factor describing the grouping of samples at the <em>plots</em> or <em>blocks</em> levels, as determined by the value of argument <code>which</code>.
 </dd>
 <dt><code>getType()</code></dt>
-<dd>returns the type of permutation of samples at the <em>within</em> or <em>plots</em> levels, as determined by the value of argument <code>which</code>.
+<dd>
+returns the type of permutation of samples at the <em>within</em> or <em>plots</em> levels, as determined by the value of argument <code>which</code>.
 </dd>
 <dt><code>getMirror()</code></dt>
-<dd>returns a logical, indicating whether permutations are drawn from the mirror image of the observed ordering at the <em>within</em> or <em>plots</em> levels, as determined by the value of argument <code>which</code>.
+<dd>
+returns a logical, indicating whether permutations are drawn from the mirror image of the observed ordering at the <em>within</em> or <em>plots</em> levels, as determined by the value of argument <code>which</code>.
 </dd>
 <dt><code>getConstant()</code></dt>
-<dd>returns a logical, indicating whether the same permutation of samples, or a different permutation, is used within each of the plots.
+<dd>
+returns a logical, indicating whether the same permutation of samples, or a different permutation, is used within each of the plots.
 </dd>
 <dt><code>getRow()</code>, <code>getCol()</code>, <code>getDim()</code></dt>
-<dd>return dimensions of the spatial grid of samples at the <em>plots</em> or <em>blocks</em> levels, as determined by the value of argument <code>which</code>.
+<dd>
+return dimensions of the spatial grid of samples at the <em>plots</em> or <em>blocks</em> levels, as determined by the value of argument <code>which</code>.
 </dd>
 <dt><code>getNperm()</code>, <code>getMaxperm()</code>, <code>getMinperm()</code></dt>
-<dd>return numerics for the stored number of permutations requested plus two triggers used when checking permutation designs via <code>check()</code>.
+<dd>
+return numerics for the stored number of permutations requested plus two triggers used when checking permutation designs via <code>check()</code>.
 </dd>
 <dt><code>getComplete()</code></dt>
-<dd>returns a logical, indicating whether complete enumeration of the set of permutations was requested.
+<dd>
+returns a logical, indicating whether complete enumeration of the set of permutations was requested.
 </dd>
 <dt><code>getMake()</code></dt>
-<dd>returns a logical, indicating whether the entire set of permutations should be produced or not.
+<dd>
+returns a logical, indicating whether the entire set of permutations should be produced or not.
 </dd>
 <dt><code>getObserved()</code></dt>
-<dd>returns a logical, which indicates whether the observed permutation (ordering of samples) is included in the entire set of permutation generated by <code>allPerms()</code>.
+<dd>
+returns a logical, which indicates whether the observed permutation (ordering of samples) is included in the entire set of permutation generated by <code>allPerms()</code>.
 </dd>
 <dt><code>getAllperms()</code></dt>
-<dd>extracts the complete set of permutations if present. Returns <code>NULL</code> if the set has not been generated.
+<dd>
+extracts the complete set of permutations if present. Returns <code>NULL</code> if the set has not been generated.
 </dd>
 </dl>
 <p>The available <code>setFoo()&lt;-</code> functions are</p>
 <dl>
 <dt><code>setPlots&lt;-()</code>, <code>setWithin&lt;-()</code></dt>
-<dd>replaces the details of the <em>within</em>-, and <em>plots</em>-, components of the design. The replacement object must be of class <code>&quot;Plots&quot;</code> or <code>&quot;Within&quot;</code>, respectively, and hence is most usefully used in combination with the <code>Plots()</code> or <code>Within()</code> constructor functions.
+<dd>
+replaces the details of the <em>within</em>-, and <em>plots</em>-, components of the design. The replacement object must be of class <code>&quot;Plots&quot;</code> or <code>&quot;Within&quot;</code>, respectively, and hence is most usefully used in combination with the <code>Plots()</code> or <code>Within()</code> constructor functions.
 </dd>
 <dt><code>setBlocks&lt;-()</code></dt>
-<dd>replaces the factor that partitions the observations into blocks. <code>value</code> can be any <em>R</em> object that can be coerced to a factor vector via <code>as.factor()</code>.
+<dd>
+replaces the factor that partitions the observations into blocks. <code>value</code> can be any <em>R</em> object that can be coerced to a factor vector via <code>as.factor()</code>.
 </dd>
 <dt><code>setStrata&lt;-()</code></dt>
-<dd>replaces either the <code>blocks</code> or <code>strata</code> components of the design, depending on what class of object <code>setStrata&lt;-()</code> is applied to. When used on an object of class <code>&quot;how&quot;</code>, <code>setStrata&lt;-()</code> replaces the <code>blocks</code> component of that object. When used on an object of class <code>&quot;Plots&quot;</code>, <code>setStrata&lt;-()</code> replaces the <code>strata</code> component of that object. In both cases a factor variable is required and the replacement object will be coerced to a factor via <code>as.factor()</code> if possible.
+<dd>
+replaces either the <code>blocks</code> or <code>strata</code> components of the design, depending on what class of object <code>setStrata&lt;-()</code> is applied to. When used on an object of class <code>&quot;how&quot;</code>, <code>setStrata&lt;-()</code> replaces the <code>blocks</code> component of that object. When used on an object of class <code>&quot;Plots&quot;</code>, <code>setStrata&lt;-()</code> replaces the <code>strata</code> component of that object. In both cases a factor variable is required and the replacement object will be coerced to a factor via <code>as.factor()</code> if possible.
 </dd>
 <dt><code>setType&lt;-()</code></dt>
-<dd>replaces the <code>type</code> component of an object of class <code>&quot;Plots&quot;</code> or <code>&quot;Within&quot;</code> with a character vector of length one. Must be one of the available types: <code>&quot;none&quot;</code>, <code>&quot;free&quot;</code>, <code>&quot;series&quot;</code>, or <code>&quot;grid&quot;</code>.
+<dd>
+replaces the <code>type</code> component of an object of class <code>&quot;Plots&quot;</code> or <code>&quot;Within&quot;</code> with a character vector of length one. Must be one of the available types: <code>&quot;none&quot;</code>, <code>&quot;free&quot;</code>, <code>&quot;series&quot;</code>, or <code>&quot;grid&quot;</code>.
 </dd>
 <dt><code>setMirror&lt;-()</code></dt>
-<dd>replaces the <code>mirror</code> component of an object of class <code>&quot;Plots&quot;</code> or <code>&quot;Within&quot;</code> with a logical vector of length one.
+<dd>
+replaces the <code>mirror</code> component of an object of class <code>&quot;Plots&quot;</code> or <code>&quot;Within&quot;</code> with a logical vector of length one.
 </dd>
 <dt><code>setConstant&lt;-()</code></dt>
-<dd>replaces the <code>constant</code> component of an object of class <code>&quot;Within&quot;</code> with a logical vector of length one.
+<dd>
+replaces the <code>constant</code> component of an object of class <code>&quot;Within&quot;</code> with a logical vector of length one.
 </dd>
 <dt><code>setRow&lt;-()</code>, <code>setCol&lt;-()</code>, <code>setDim&lt;-()</code></dt>
-<dd>replace one or both of the spatial grid dimensions of an object of class <code>&quot;Plots&quot;</code> or <code>&quot;Within&quot;</code> with am integer vector of length one, or, in the case of <code>setDim&lt;-()</code>, of length 2.
+<dd>
+replace one or both of the spatial grid dimensions of an object of class <code>&quot;Plots&quot;</code> or <code>&quot;Within&quot;</code> with am integer vector of length one, or, in the case of <code>setDim&lt;-()</code>, of length 2.
 </dd>
 <dt><code>setNperm&lt;-()</code>, <code>setMinperm&lt;-()</code>, <code>setMaxperm&lt;-()</code></dt>
-<dd>update the stored values for the requested number of permutations and the minimum and maximum permutation thresholds that control whether the entire set of permutations is generated instead of <code>nperm</code> permutations.
+<dd>
+update the stored values for the requested number of permutations and the minimum and maximum permutation thresholds that control whether the entire set of permutations is generated instead of <code>nperm</code> permutations.
 </dd>
 <dt><code>setAllperms&lt;-()</code></dt>
-<dd>assigns a matrix of permutation indices to the <code>all.perms</code> component of the design list object.
+<dd>
+assigns a matrix of permutation indices to the <code>all.perms</code> component of the design list object.
 </dd>
 <dt><code>setComplete&lt;-()</code></dt>
-<dd>updates the status of the <code>complete</code> setting. Takes a logical vector of length 1 or any object coercible to such.
+<dd>
+updates the status of the <code>complete</code> setting. Takes a logical vector of length 1 or any object coercible to such.
 </dd>
 <dt><code>setMake&lt;-()</code></dt>
-<dd>sets the indicator controlling whether the entrie set of permutations is generated during checking of the design via <code>check()</code>. Takes a logical vector of length 1 or any object coercible to such.
+<dd>
+sets the indicator controlling whether the entrie set of permutations is generated during checking of the design via <code>check()</code>. Takes a logical vector of length 1 or any object coercible to such.
 </dd>
 <dt><code>setObserved&lt;-()</code></dt>
-<dd>updates the indicator of whether the observed ordering is included in the set of all permutations should they be generated. Takes a logical vector of length 1 or any object coercible to such.
+<dd>
+updates the indicator of whether the observed ordering is included in the set of all permutations should they be generated. Takes a logical vector of length 1 or any object coercible to such.
 </dd>
 </dl>
 <p><em>Examples</em></p>
 <p>I illustrate the behaviour of the <code>getFoo()</code> and <code>setFoo&lt;-()</code> functions through a couple of simple examples. Firstly, generate a design object</p>
-<div class="sourceCode" id="cb54"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb54-1" title="1">hh &lt;-<span class="st"> </span><span class="kw">how</span>()</a></code></pre></div>
+<div class="sourceCode" id="cb54"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb54-1"><a href="#cb54-1" aria-hidden="true" tabindex="-1"></a>hh <span class="ot">&lt;-</span> <span class="fu">how</span>()</span></code></pre></div>
 <p>This design is one of complete randomization, so all of the settings in the object take their default values. The default number of permutations is currently 199, and can be extracted using <code>getNperm()</code></p>
-<div class="sourceCode" id="cb55"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb55-1" title="1"><span class="kw">getNperm</span>(hh)</a></code></pre></div>
+<div class="sourceCode" id="cb55"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb55-1"><a href="#cb55-1" aria-hidden="true" tabindex="-1"></a><span class="fu">getNperm</span>(hh)</span></code></pre></div>
 <pre><code>## [1] 199</code></pre>
 <p>The corresponding replacement function can be use to alter the number of permutations after the design has been generated. To illustrate a finer point of the behaviour of these replacement functions, compare the matched call stored in <code>hh</code> before and after the number of permutations is changed</p>
-<div class="sourceCode" id="cb57"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb57-1" title="1"><span class="kw">getCall</span>(hh)</a></code></pre></div>
+<div class="sourceCode" id="cb57"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb57-1"><a href="#cb57-1" aria-hidden="true" tabindex="-1"></a><span class="fu">getCall</span>(hh)</span></code></pre></div>
 <pre><code>## how()</code></pre>
-<div class="sourceCode" id="cb59"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb59-1" title="1"><span class="kw">setNperm</span>(hh) &lt;-<span class="st"> </span><span class="dv">999</span></a>
-<a class="sourceLine" id="cb59-2" title="2"><span class="kw">getNperm</span>(hh)</a></code></pre></div>
+<div class="sourceCode" id="cb59"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb59-1"><a href="#cb59-1" aria-hidden="true" tabindex="-1"></a><span class="fu">setNperm</span>(hh) <span class="ot">&lt;-</span> <span class="dv">999</span></span>
+<span id="cb59-2"><a href="#cb59-2" aria-hidden="true" tabindex="-1"></a><span class="fu">getNperm</span>(hh)</span></code></pre></div>
 <pre><code>## [1] 999</code></pre>
-<div class="sourceCode" id="cb61"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb61-1" title="1"><span class="kw">getCall</span>(hh)</a></code></pre></div>
+<div class="sourceCode" id="cb61"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb61-1"><a href="#cb61-1" aria-hidden="true" tabindex="-1"></a><span class="fu">getCall</span>(hh)</span></code></pre></div>
 <pre><code>## how(nperm = 999)</code></pre>
 <p>Note how the <code>call</code> component has been altered to include the argument pair <code>nperm = 999</code>, hence if this call were evaluated, the resulting object would be a copy of <code>hh</code>.</p>
 <p>As a more complex example, consider the following design consisting of 5 blocks, each containing 2 plots of 5 samples each. Hence there are a total of 10 plots. Both the plots and within-plot sample are time series. This design can be created using</p>
-<div class="sourceCode" id="cb63"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb63-1" title="1">hh &lt;-<span class="st"> </span><span class="kw">how</span>(<span class="dt">within =</span> <span class="kw">Within</span>(<span class="dt">type =</span> <span class="st">&quot;series&quot;</span>),</a>
-<a class="sourceLine" id="cb63-2" title="2">          <span class="dt">plots =</span> <span class="kw">Plots</span>(<span class="dt">type =</span> <span class="st">&quot;series&quot;</span>, <span class="dt">strata =</span> <span class="kw">gl</span>(<span class="dv">10</span>, <span class="dv">5</span>)),</a>
-<a class="sourceLine" id="cb63-3" title="3">          <span class="dt">blocks =</span> <span class="kw">gl</span>(<span class="dv">5</span>, <span class="dv">10</span>))</a></code></pre></div>
+<div class="sourceCode" id="cb63"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb63-1"><a href="#cb63-1" aria-hidden="true" tabindex="-1"></a>hh <span class="ot">&lt;-</span> <span class="fu">how</span>(<span class="at">within =</span> <span class="fu">Within</span>(<span class="at">type =</span> <span class="st">&quot;series&quot;</span>),</span>
+<span id="cb63-2"><a href="#cb63-2" aria-hidden="true" tabindex="-1"></a>          <span class="at">plots =</span> <span class="fu">Plots</span>(<span class="at">type =</span> <span class="st">&quot;series&quot;</span>, <span class="at">strata =</span> <span class="fu">gl</span>(<span class="dv">10</span>, <span class="dv">5</span>)),</span>
+<span id="cb63-3"><a href="#cb63-3" aria-hidden="true" tabindex="-1"></a>          <span class="at">blocks =</span> <span class="fu">gl</span>(<span class="dv">5</span>, <span class="dv">10</span>))</span></code></pre></div>
 <p>To alter the design at the plot or within-plot levels, it is convenient to extract the relevant component using <code>getPlots()</code> or <code>getWithin()</code>, update the extracted object, and finally use the updated object to update <code>hh</code>. This process is illustrated below in order to change the plot-level permutation type to <code>&quot;free&quot;</code></p>
-<div class="sourceCode" id="cb64"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb64-1" title="1">pl &lt;-<span class="st"> </span><span class="kw">getPlots</span>(hh)</a>
-<a class="sourceLine" id="cb64-2" title="2"><span class="kw">setType</span>(pl) &lt;-<span class="st"> &quot;free&quot;</span></a>
-<a class="sourceLine" id="cb64-3" title="3"><span class="kw">setPlots</span>(hh) &lt;-<span class="st"> </span>pl</a></code></pre></div>
+<div class="sourceCode" id="cb64"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb64-1"><a href="#cb64-1" aria-hidden="true" tabindex="-1"></a>pl <span class="ot">&lt;-</span> <span class="fu">getPlots</span>(hh)</span>
+<span id="cb64-2"><a href="#cb64-2" aria-hidden="true" tabindex="-1"></a><span class="fu">setType</span>(pl) <span class="ot">&lt;-</span> <span class="st">&quot;free&quot;</span></span>
+<span id="cb64-3"><a href="#cb64-3" aria-hidden="true" tabindex="-1"></a><span class="fu">setPlots</span>(hh) <span class="ot">&lt;-</span> pl</span></code></pre></div>
 <p>We can confirm this has been changed by extracting the permutation type for the plot level</p>
-<div class="sourceCode" id="cb65"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb65-1" title="1"><span class="kw">getType</span>(hh, <span class="dt">which =</span> <span class="st">&quot;plots&quot;</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb65"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb65-1"><a href="#cb65-1" aria-hidden="true" tabindex="-1"></a><span class="fu">getType</span>(hh, <span class="at">which =</span> <span class="st">&quot;plots&quot;</span>)</span></code></pre></div>
 <pre><code>## [1] &quot;free&quot;</code></pre>
 <p>Notice too how the call has been expanded from <code>gl(10, 5)</code> to an integer vector. This expansion is to avoid the obvious problem of locating the objects referred to in the call should the call be re-evaluated later.</p>
-<div class="sourceCode" id="cb67"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb67-1" title="1"><span class="kw">getCall</span>(<span class="kw">getPlots</span>(hh))</a></code></pre></div>
+<div class="sourceCode" id="cb67"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb67-1"><a href="#cb67-1" aria-hidden="true" tabindex="-1"></a><span class="fu">getCall</span>(<span class="fu">getPlots</span>(hh))</span></code></pre></div>
 <pre><code>## Plots(strata = c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 3L, 
 ## 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 
 ## 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 
 ## 9L, 9L, 10L, 10L, 10L, 10L, 10L), type = &quot;free&quot;)</code></pre>
 <p>At the top level, a user can update the design using <code>update()</code>. Hence the equivalent of the above update is (this time resetting the original type; <code>type = &quot;series&quot;</code>)</p>
-<div class="sourceCode" id="cb69"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb69-1" title="1">hh &lt;-<span class="st"> </span><span class="kw">update</span>(hh, <span class="dt">plots =</span> <span class="kw">update</span>(<span class="kw">getPlots</span>(hh), <span class="dt">type =</span> <span class="st">&quot;series&quot;</span>))</a>
-<a class="sourceLine" id="cb69-2" title="2"><span class="kw">getType</span>(hh, <span class="dt">which =</span> <span class="st">&quot;plots&quot;</span>)</a></code></pre></div>
+<div class="sourceCode" id="cb69"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb69-1"><a href="#cb69-1" aria-hidden="true" tabindex="-1"></a>hh <span class="ot">&lt;-</span> <span class="fu">update</span>(hh, <span class="at">plots =</span> <span class="fu">update</span>(<span class="fu">getPlots</span>(hh), <span class="at">type =</span> <span class="st">&quot;series&quot;</span>))</span>
+<span id="cb69-2"><a href="#cb69-2" aria-hidden="true" tabindex="-1"></a><span class="fu">getType</span>(hh, <span class="at">which =</span> <span class="st">&quot;plots&quot;</span>)</span></code></pre></div>
 <pre><code>## [1] &quot;series&quot;</code></pre>
 <p>However, this approach is not assured of working within a function because we do not guarantee that components of the call used to create <code>hh</code> can be found from the execution frame where <code>update()</code> is called. To be safe, always use the <code>setFoo&lt;-()</code> replacement functions to update design objects from within your functions.</p>
 </div>
@@ -845,76 +905,76 @@ fligner.test(Length ~ Sex, data = jackal)</code></pre>
 <div id="computational-details" class="section level1">
 <h1>Computational details</h1>
 <p>This vignette was built within the following environment:</p>
-<pre><code>## ─ Session info ───────────────────────────────────────────────────────────────
+<pre><code>## - Session info ---------------------------------------------------------------
 ##  setting  value
-##  version  R version 4.1.2 (2021-11-01)
-##  os       Ubuntu 20.04.3 LTS
+##  version  R version 4.2.1 (2022-06-23)
+##  os       Debian GNU/Linux bookworm/sid
 ##  system   x86_64, linux-gnu
 ##  ui       X11
-##  language en_GB:en
+##  language (EN)
 ##  collate  C
-##  ctype    en_GB.UTF-8
-##  tz       Europe/Copenhagen
-##  date     2022-01-27
-##  pandoc   2.5 @ /usr/bin/ (via rmarkdown)
+##  ctype    C
+##  tz       Etc/UTC
+##  date     2022-10-18
+##  pandoc   2.17.1.1 @ /usr/bin/ (via rmarkdown)
 ## 
-## ─ Packages ───────────────────────────────────────────────────────────────────
+## - Packages -------------------------------------------------------------------
 ##  package     * version date (UTC) lib source
-##  bookdown      0.24    2021-09-02 [2] RSPM (R 4.1.2)
-##  bslib         0.3.1   2021-10-06 [2] RSPM (R 4.1.2)
-##  cli           3.1.1   2022-01-20 [2] RSPM (R 4.1.2)
-##  digest        0.6.29  2021-12-01 [2] RSPM (R 4.1.2)
-##  evaluate      0.14    2019-05-28 [2] RSPM (R 4.1.2)
-##  fastmap       1.1.0   2021-01-25 [2] RSPM (R 4.1.2)
-##  highr         0.9     2021-04-16 [2] RSPM (R 4.1.2)
-##  htmltools     0.5.2   2021-08-25 [2] RSPM (R 4.1.2)
-##  jquerylib     0.1.4   2021-04-26 [2] RSPM (R 4.1.2)
-##  jsonlite      1.7.3   2022-01-17 [2] RSPM (R 4.1.2)
-##  knitr         1.37    2021-12-16 [2] RSPM (R 4.1.2)
-##  magrittr      2.0.1   2020-11-17 [2] RSPM (R 4.1.2)
-##  permute     * 0.9-7   2022-01-27 [1] local
-##  R6            2.5.1   2021-08-19 [2] RSPM (R 4.1.2)
-##  rlang         0.4.12  2021-10-18 [2] RSPM (R 4.1.2)
-##  rmarkdown     2.11    2021-09-14 [2] RSPM (R 4.1.2)
-##  sass          0.4.0   2021-05-12 [2] RSPM (R 4.1.2)
-##  sessioninfo   1.2.2   2021-12-06 [2] RSPM (R 4.1.2)
-##  stringi       1.7.6   2021-11-29 [2] RSPM (R 4.1.2)
-##  stringr       1.4.0   2019-02-10 [2] RSPM (R 4.1.2)
-##  xfun          0.29    2021-12-14 [2] RSPM (R 4.1.2)
-##  yaml          2.2.1   2020-02-01 [2] RSPM (R 4.1.2)
+##  bookdown      0.29    &lt;NA&gt;       [3] local
+##  bslib         0.4.0   2022-07-16 [3] CRAN (R 4.2.1)
+##  cachem        1.0.6   2021-08-19 [3] CRAN (R 4.2.1)
+##  cli           3.4.1   2022-09-23 [3] CRAN (R 4.2.1)
+##  digest        0.6.29  2021-12-01 [3] CRAN (R 4.2.1)
+##  evaluate      0.17    2022-10-07 [3] CRAN (R 4.2.1)
+##  fastmap       1.1.0   2021-01-25 [3] CRAN (R 4.0.3)
+##  highr         0.9     2021-04-16 [3] CRAN (R 4.1.1)
+##  htmltools     0.5.3   2022-07-18 [3] CRAN (R 4.2.1)
+##  jquerylib     0.1.4   2021-04-26 [3] CRAN (R 4.2.1)
+##  jsonlite      1.8.2   2022-10-02 [3] CRAN (R 4.2.1)
+##  knitr         1.40    2022-08-24 [3] CRAN (R 4.2.1)
+##  magrittr      2.0.3   2022-03-30 [3] CRAN (R 4.2.0)
+##  permute     * 0.9-7   2022-10-18 [1] local
+##  R6            2.5.1   2021-08-19 [3] CRAN (R 4.1.1)
+##  rlang         1.0.6   2022-09-24 [3] CRAN (R 4.2.1)
+##  rmarkdown     2.17    2022-10-07 [3] CRAN (R 4.2.1)
+##  sass          0.4.2   2022-07-16 [3] CRAN (R 4.2.1)
+##  sessioninfo   1.2.2   2021-12-06 [3] CRAN (R 4.1.2)
+##  stringi       1.7.8   2022-07-11 [3] CRAN (R 4.2.1)
+##  stringr       1.4.1   2022-08-20 [3] CRAN (R 4.2.1)
+##  xfun          0.33    2022-09-12 [3] CRAN (R 4.2.1)
+##  yaml          2.3.5   2022-02-21 [3] CRAN (R 4.1.2)
 ## 
-##  [1] /tmp/Rtmpa1uS5V/Rinst15d8443d237e8
-##  [2] /home/au690221/R/x86_64-pc-linux-gnu-library/4.1
-##  [3] /usr/local/lib/R/site-library
-##  [4] /usr/lib/R/site-library
-##  [5] /usr/lib/R/library
+##  [1] /tmp/RtmpVdxVEU/Rinst5e0067d84ccb
+##  [2] /usr/local/lib/R/site-library
+##  [3] /usr/lib/R/site-library
+##  [4] /usr/lib/R/library
 ## 
-## ──────────────────────────────────────────────────────────────────────────────</code></pre>
-<div id="refs" class="references">
-<div id="ref-besagclifford">
-<p>Besag, J., and P. Clifford. 1989. “Generalized Monte Carlo Significance Tests.” <em>Biometrika</em> 76 (4): 633–42.</p>
+## ------------------------------------------------------------------------------</code></pre>
+<div id="refs" class="references csl-bib-body hanging-indent">
+<div id="ref-besagclifford" class="csl-entry">
+Besag, J., and P. Clifford. 1989. <span>“Generalized Monte Carlo Significance Tests.”</span> <em>Biometrika</em> 76 (4): 633–42.
 </div>
-<div id="ref-canoco31">
-<p>Braak, C.J.F. ter. 1990. <em>Update Notes: CANOCO Version 3.1</em>. Wageningen: Agricultural Mathematics Group.</p>
+<div id="ref-canoco31" class="csl-entry">
+Braak, C. J. F. ter. 1990. <em>Update Notes: CANOCO Version 3.1</em>. Wageningen: Agricultural Mathematics Group.
 </div>
-<div id="ref-canoco5manual">
-<p>Braak, C.J.F. ter, and P. Šmilauer. 2012. <em>Canoco Reference Manual and User’s Guide: Software for Ordination (Version 5.0)</em>. Microcomputer Power.</p>
+<div id="ref-canoco5manual" class="csl-entry">
+Braak, C. J. F. ter, and P. Šmilauer. 2012. <em>Canoco Reference Manual and User’s Guide: Software for Ordination (Version 5.0)</em>. Microcomputer Power.
 </div>
-<div id="ref-higham80">
-<p>Higham, C.F.W, A. Kijngam, and B.F.J. Manly. 1980. “An Analysis of Prehistoric Canid Remains from Thailand.” <em>Journal of Archaeological Science</em> 7: 149–65.</p>
+<div id="ref-higham80" class="csl-entry">
+Higham, C. F. W, A. Kijngam, and B. F. J. Manly. 1980. <span>“An Analysis of Prehistoric Canid Remains from <span>T</span>hailand.”</span> <em>Journal of Archaeological Science</em> 7: 149–65.
 </div>
-<div id="ref-manly07">
-<p>Manly, B.F.J. 2007. <em>Randomization, Bootstrap and Monte Carlo Methods in Biology</em>. 3rd ed. Boca Raton: Chapman &amp; Hall/CRC.</p>
+<div id="ref-manly07" class="csl-entry">
+Manly, B. F. J. 2007. <em>Randomization, Bootstrap and Monte Carlo Methods in Biology</em>. 3rd ed. Boca Raton: Chapman &amp; Hall/CRC.
 </div>
-<div id="ref-vegan">
-<p>Oksanen, Jari, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, Peter R. Minchin, R. B. O’Hara, Gavin L. Simpson, Peter Solymos, M. Henry H. Stevens, and Helene Wagner. 2013. <em>Vegan: Community Ecology Package</em>. <a href="http://vegan.r-forge.r-project.org/">http://vegan.r-forge.r-project.org/</a>.</p>
+<div id="ref-vegan" class="csl-entry">
+Oksanen, Jari, F. Guillaume Blanchet, Roeland Kindt, Pierre Legendre, Peter R. Minchin, R. B. O’Hara, Gavin L. Simpson, Peter Solymos, M. Henry H. Stevens, and Helene Wagner. 2013. <em>Vegan: Community Ecology Package</em>. <a href="http://vegan.r-forge.r-project.org/">http://vegan.r-forge.r-project.org/</a>.
 </div>
 </div>
 </div>
-<div class="footnotes">
+<div class="footnotes footnotes-end-of-document">
 <hr />
 <ol>
-<li id="fn1"><p>The trigger is via the utility function <code>check()</code>, which calls another utility function, <code>allPerms()</code>, to generate the set of permutations for the stated design. The trigger for complete enumeration is set via <code>how()</code> using argument <code>minperm</code>; below this value, by default <code>check()</code> will generate the entire set of permutations.<a href="#fnref1" class="footnote-back">↩</a></p></li>
+<li id="fn1"><p>The trigger is via the utility function <code>check()</code>, which calls another utility function, <code>allPerms()</code>, to generate the set of permutations for the stated design. The trigger for complete enumeration is set via <code>how()</code> using argument <code>minperm</code>; below this value, by default <code>check()</code> will generate the entire set of permutations.<a href="#fnref1" class="footnote-back">↩︎</a></p></li>
 </ol>
 </div>
 

Debdiff

File lists identical (after any substitutions)

Control files: lines which differ (wdiff format)

  • Depends: r-base-core (>= 4.1.3.20220413-2~jan+lint1), 4.2.1-3), r-api-4.0

More details

Full run details