[Vegan-commits] r2672 - pkg/permute/tests/Examples

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Nov 7 23:56:34 CET 2013


Author: gsimpson
Date: 2013-11-07 23:56:34 +0100 (Thu, 07 Nov 2013)
New Revision: 2672

Modified:
   pkg/permute/tests/Examples/permute-Ex.Rout.save
Log:
update the reference check material

Modified: pkg/permute/tests/Examples/permute-Ex.Rout.save
===================================================================
--- pkg/permute/tests/Examples/permute-Ex.Rout.save	2013-11-07 22:37:05 UTC (rev 2671)
+++ pkg/permute/tests/Examples/permute-Ex.Rout.save	2013-11-07 22:56:34 UTC (rev 2672)
@@ -1,7 +1,7 @@
 
-R version 3.0.1 (2013-05-16) -- "Good Sport"
+R version 3.0.2 Patched (2013-10-07 r64035) -- "Frisbee Sailing"
 Copyright (C) 2013 The R Foundation for Statistical Computing
-Platform: x86_64-pc-linux-gnu (64-bit)
+Platform: x86_64-unknown-linux-gnu (64-bit)
 
 R is free software and comes with ABSOLUTELY NO WARRANTY.
 You are welcome to redistribute it under certain conditions.
@@ -73,7 +73,8 @@
 [5,]    6    1    2    3    4    5   12    7    8     9    10    11
 > 
 > ## turn on mirroring
-> ctrl$within$mirror <- TRUE
+> ##ctrl$within$mirror <- TRUE
+> ctrl <- update(ctrl, within = update(getWithin(ctrl), mirror = TRUE))
 > numPerms(seq_len(Nobs), control = ctrl)
 [1] 12
 > (tmp3 <- allPerms(Nobs, control = ctrl, observed = TRUE))
@@ -111,10 +112,31 @@
 	Complete enumeration of permutations
 
 Permutation Scheme:
-NULL
+
+Permutation Design:
+
+Blocks:
+  Defined by: none
+
+Plots:
+  Plots: fac
+  Permutation type: none
+  Mirrored?: No
+
+Within Plots:
+  Permutation type: grid
+  Mirrored?: Yes
+  Different permutation within each Plot?: No
+  Grid dimensions: 3 rows 2 cols
+
+Permutation details:
+  Number of permutations requested: 199
+  Max. number of permutations allowed: 9999
+  Evaluate all permutations?: No.  Activation limit: 99
+
+All permutations:
 Contains observed ordering?: Yes 
 
-All permutations:
       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
  [1,]    2    3    4    5    6    1    8    9   10    11    12     7
  [2,]    3    4    5    6    1    2    9   10   11    12     7     8
@@ -133,10 +155,31 @@
 	Complete enumeration of permutations
 
 Permutation Scheme:
-NULL
+
+Permutation Design:
+
+Blocks:
+  Defined by: none
+
+Plots:
+  Plots: fac
+  Permutation type: none
+  Mirrored?: No
+
+Within Plots:
+  Permutation type: grid
+  Mirrored?: Yes
+  Different permutation within each Plot?: No
+  Grid dimensions: 3 rows 2 cols
+
+Permutation details:
+  Number of permutations requested: 198
+  Max. number of permutations allowed: 9999
+  Evaluate all permutations?: No.  Activation limit: 99
+
+All permutations:
 Contains observed ordering?: No 
 
-All permutations:
       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
  [1,]    2    3    4    5    6    1    8    9   10    11    12     7
  [2,]    3    4    5    6    1    2    9   10   11    12     7     8
@@ -153,6 +196,292 @@
 > 
 > 
 > cleanEx()
+> nameEx("check")
+> ### * check
+> 
+> flush(stderr()); flush(stdout())
+> 
+> ### Name: check
+> ### Title: Utility functions for permutation schemes
+> ### Aliases: check print.check print.summary.check summary.check permuplot
+> ### Keywords: utilities design methods
+> 
+> ### ** Examples
+> 
+> ## use example data from ?pyrifos in package vegan
+> require(vegan)
+Loading required package: vegan
+Loading required package: lattice
+This is vegan 2.1-33
+> example(pyrifos)
+
+pyrifs> data(pyrifos)
+
+pyrifs> ditch <- gl(12, 1, length=132)
+
+pyrifs> week <- gl(11, 12, labels=c(-4, -1, 0.1, 1, 2, 4, 8, 12, 15, 19, 24))
+
+pyrifs> dose <- factor(rep(c(0.1, 0, 0, 0.9, 0, 44, 6, 0.1, 44, 0.9, 0, 6), 11))
+> 
+> ## Demonstrate the maximum number of permutations for the pyrifos data
+> ## under a series of permutation schemes
+> 
+> ## no restrictions - lots of perms
+> CONTROL <- how(within = Within(type = "free"))
+> (check1 <- check(pyrifos, CONTROL))
+[1] 1.118249e+224
+> ##summary(check1)
+> 
+> ## no strata but data are series with no mirroring, so 132 permutations
+> CONTROL <- how(within = Within(type = "series", mirror = FALSE))
+> check(pyrifos, CONTROL)
+[1] 132
+> 
+> ## no strata but data are series with mirroring, so 264 permutations
+> CONTROL <- how(within = Within(type = "series", mirror = TRUE))
+> check(pyrifos, control = CONTROL)
+[1] 264
+> 
+> ## unrestricted within strata
+> check(pyrifos, control = how(plots = Plots(strata = ditch),
++                              within = Within(type = "free")))
+[1] 1.636321e+91
+> 
+> ## time series within strata, no mirroring
+> check(pyrifos,
++       control = how(plots = Plots(strata = ditch),
++                     within = Within(type = "series", mirror = FALSE)))
+[1] 3.138428e+12
+> 
+> ## time series within strata, with mirroring
+> check(pyrifos,
++       control = how(plots = Plots(strata = ditch),
++                     within = Within(type = "series", mirror = TRUE)))
+[1] 1.2855e+16
+> 
+> ## time series within strata, no mirroring, same permutation
+> ## within strata
+> check(pyrifos,
++       control = how(plots = Plots(strata = ditch),
++                     within = Within(type = "series", constant = TRUE)))
+[1] 11
+> 
+> ## time series within strata, with mirroring, same permutation
+> ## within strata
+> check(pyrifos,
++       control = how(plots = Plots(strata = ditch),
++                     within = Within(type = "series", mirror = TRUE,
++                                     constant = TRUE)))
+[1] 22
+> ## permute strata
+> check(pyrifos, how(plots = Plots(strata = ditch, type = "free"),
++                    within = Within(type = "none")))
+[1] 479001600
+> 
+> ## this should also also for arbitrary vectors
+> vec1 <- check(1:100)
+> vec2 <- check(1:100, how())
+> all.equal(vec1, vec2)
+[1] TRUE
+> vec3 <- check(1:100, how(within = Within(type = "series")))
+> all.equal(100, vec3$n)
+[1] TRUE
+> vec4 <- check(1:100, how(within = Within(type= "series", mirror = TRUE)))
+> all.equal(vec4$n, 200)
+[1] TRUE
+> 
+> ## enumerate all possible permutations
+> fac <- gl(2,6)
+> ctrl <- how(plots = Plots(strata = fac),
++             within = Within(type = "grid", mirror = FALSE,
++                             constant = TRUE, nrow = 3, ncol = 2))
+> check(1:12, ctrl)
+[1] 6
+> 
+> numPerms(1:12, control = ctrl)
+[1] 6
+> (tmp <- allPerms(12, control = ctrl, observed = TRUE))
+     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
+[1,]    2    3    4    5    6    1    8    9   10    11    12     7
+[2,]    3    4    5    6    1    2    9   10   11    12     7     8
+[3,]    4    5    6    1    2    3   10   11   12     7     8     9
+[4,]    5    6    1    2    3    4   11   12    7     8     9    10
+[5,]    6    1    2    3    4    5   12    7    8     9    10    11
+[6,]    1    2    3    4    5    6    7    8    9    10    11    12
+> (tmp2 <- allPerms(12, control = ctrl))
+     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
+[1,]    2    3    4    5    6    1    8    9   10    11    12     7
+[2,]    3    4    5    6    1    2    9   10   11    12     7     8
+[3,]    4    5    6    1    2    3   10   11   12     7     8     9
+[4,]    5    6    1    2    3    4   11   12    7     8     9    10
+[5,]    6    1    2    3    4    5   12    7    8     9    10    11
+> 
+> ## turn on mirroring %%FIXME needs a proper method to do this
+> ##ctrl$within$mirror <- TRUE
+> ctrl <- update(ctrl, within = update(getWithin(ctrl), mirror = TRUE))
+> numPerms(1:12, control = ctrl)
+[1] 12
+> (tmp3 <- allPerms(12, control = ctrl, observed = TRUE))
+      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
+ [1,]    2    3    4    5    6    1    8    9   10    11    12     7
+ [2,]    3    4    5    6    1    2    9   10   11    12     7     8
+ [3,]    4    5    6    1    2    3   10   11   12     7     8     9
+ [4,]    5    6    1    2    3    4   11   12    7     8     9    10
+ [5,]    6    1    2    3    4    5   12    7    8     9    10    11
+ [6,]    1    2    3    4    5    6    7    8    9    10    11    12
+ [7,]    1    6    5    4    3    2    7   12   11    10     9     8
+ [8,]    2    1    6    5    4    3    8    7   12    11    10     9
+ [9,]    3    2    1    6    5    4    9    8    7    12    11    10
+[10,]    4    3    2    1    6    5   10    9    8     7    12    11
+[11,]    5    4    3    2    1    6   11   10    9     8     7    12
+[12,]    6    5    4    3    2    1   12   11   10     9     8     7
+> (tmp4 <- allPerms(12, control = ctrl))
+      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
+ [1,]    2    3    4    5    6    1    8    9   10    11    12     7
+ [2,]    3    4    5    6    1    2    9   10   11    12     7     8
+ [3,]    4    5    6    1    2    3   10   11   12     7     8     9
+ [4,]    5    6    1    2    3    4   11   12    7     8     9    10
+ [5,]    6    1    2    3    4    5   12    7    8     9    10    11
+ [6,]    1    6    5    4    3    2    7   12   11    10     9     8
+ [7,]    2    1    6    5    4    3    8    7   12    11    10     9
+ [8,]    3    2    1    6    5    4    9    8    7    12    11    10
+ [9,]    4    3    2    1    6    5   10    9    8     7    12    11
+[10,]    5    4    3    2    1    6   11   10    9     8     7    12
+[11,]    6    5    4    3    2    1   12   11   10     9     8     7
+> ## prints out details of the permutation scheme as
+> ## well as the matrix of permutations
+> summary(tmp) 
+
+	Complete enumeration of permutations
+
+Permutation Scheme:
+
+Permutation Design:
+
+Blocks:
+  Defined by: none
+
+Plots:
+  Plots: fac
+  Permutation type: none
+  Mirrored?: No
+
+Within Plots:
+  Permutation type: grid
+  Mirrored?: No
+  Different permutation within each Plot?: No
+  Grid dimensions: 3 rows 2 cols
+
+Permutation details:
+  Number of permutations requested: 199
+  Max. number of permutations allowed: 9999
+  Evaluate all permutations?: No.  Activation limit: 99
+
+All permutations:
+Contains observed ordering?: Yes 
+
+     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
+[1,]    2    3    4    5    6    1    8    9   10    11    12     7
+[2,]    3    4    5    6    1    2    9   10   11    12     7     8
+[3,]    4    5    6    1    2    3   10   11   12     7     8     9
+[4,]    5    6    1    2    3    4   11   12    7     8     9    10
+[5,]    6    1    2    3    4    5   12    7    8     9    10    11
+[6,]    1    2    3    4    5    6    7    8    9    10    11    12
+> summary(tmp2)
+
+	Complete enumeration of permutations
+
+Permutation Scheme:
+
+Permutation Design:
+
+Blocks:
+  Defined by: none
+
+Plots:
+  Plots: fac
+  Permutation type: none
+  Mirrored?: No
+
+Within Plots:
+  Permutation type: grid
+  Mirrored?: No
+  Different permutation within each Plot?: No
+  Grid dimensions: 3 rows 2 cols
+
+Permutation details:
+  Number of permutations requested: 198
+  Max. number of permutations allowed: 9999
+  Evaluate all permutations?: No.  Activation limit: 99
+
+All permutations:
+Contains observed ordering?: No 
+
+     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
+[1,]    2    3    4    5    6    1    8    9   10    11    12     7
+[2,]    3    4    5    6    1    2    9   10   11    12     7     8
+[3,]    4    5    6    1    2    3   10   11   12     7     8     9
+[4,]    5    6    1    2    3    4   11   12    7     8     9    10
+[5,]    6    1    2    3    4    5   12    7    8     9    10    11
+> 
+> ## different numbers of observations per level of strata
+> fac <- factor(rep(1:3, times = c(3,2,2)))
+> ## free permutations in levels of strata
+> numPerms(7, how(within = Within(type = "free"),
++                 plots = Plots(strata = fac, type = "none")))
+[1] 24
+> allPerms(7, how(within = Within(type = "free"),
++                 plots = Plots(strata = fac)))
+      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
+ [1,]    1    2    3    4    5    7    6
+ [2,]    1    2    3    5    4    6    7
+ [3,]    1    2    3    5    4    7    6
+ [4,]    1    3    2    4    5    6    7
+ [5,]    1    3    2    4    5    7    6
+ [6,]    1    3    2    5    4    6    7
+ [7,]    1    3    2    5    4    7    6
+ [8,]    2    1    3    4    5    6    7
+ [9,]    2    1    3    4    5    7    6
+[10,]    2    1    3    5    4    6    7
+[11,]    2    1    3    5    4    7    6
+[12,]    2    3    1    4    5    6    7
+[13,]    2    3    1    4    5    7    6
+[14,]    2    3    1    5    4    6    7
+[15,]    2    3    1    5    4    7    6
+[16,]    3    1    2    4    5    6    7
+[17,]    3    1    2    4    5    7    6
+[18,]    3    1    2    5    4    6    7
+[19,]    3    1    2    5    4    7    6
+[20,]    3    2    1    4    5    6    7
+[21,]    3    2    1    4    5    7    6
+[22,]    3    2    1    5    4    6    7
+[23,]    3    2    1    5    4    7    6
+> ## series permutations in levels of strata
+> ctrl <- how(within = Within(type = "series"), plots = Plots(strata = fac))
+> numPerms(7, control = ctrl)
+[1] 12
+> allPerms(7, control = ctrl)
+      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
+ [1,]    2    3    1    5    4    7    6
+ [2,]    2    3    1    5    4    6    7
+ [3,]    2    3    1    4    5    7    6
+ [4,]    2    3    1    4    5    6    7
+ [5,]    3    1    2    5    4    7    6
+ [6,]    3    1    2    5    4    6    7
+ [7,]    3    1    2    4    5    7    6
+ [8,]    3    1    2    4    5    6    7
+ [9,]    1    2    3    5    4    7    6
+[10,]    1    2    3    5    4    6    7
+[11,]    1    2    3    4    5    7    6
+> 
+> 
+> 
+> 
+> 
+> cleanEx()
+
+detaching ‘package:vegan’, ‘package:lattice’
+
 > nameEx("get-methods")
 > ### * get-methods
 > 
@@ -172,7 +501,8 @@
 > ###   getCol.permControl getDim getDim.default getDim.how
 > ###   getDim.permControl getNperm getNperm.default getNperm.how
 > ###   getNperm.permControl getMaxperm getMaxperm.default getMaxperm.how
-> ###   getMaxperm.permControl getComplete getComplete.default
+> ###   getMaxperm.permControl getMinperm getMinperm.default getMinperm.how
+> ###   getMinperm.permControl getComplete getComplete.default
 > ###   getComplete.how getComplete.permControl
 > ### Keywords: methods utils
 > 
@@ -184,6 +514,73 @@
 > 
 > 
 > cleanEx()
+> nameEx("how")
+> ### * how
+> 
+> flush(stderr()); flush(stdout())
+> 
+> ### Name: how
+> ### Title: How to define a permutation design?
+> ### Aliases: how print.how Blocks Within Plots
+> ### Keywords: utils
+> 
+> ### ** Examples
+> 
+> plts <- gl(4,10)
+> blks <- gl(2,20)
+> h1 <- how(within = Within(type = "series", mirror = TRUE),
++           plots = Plots(strata = plts, type = "series"),
++           blocks = blks)
+> 
+> ## The design can be updated...
+> ## ... remove the blocking:
+> update(h1, blocks = NULL)
+
+Permutation Design:
+
+Blocks:
+  Defined by: none
+
+Plots:
+  Plots: plts
+  Permutation type: series
+  Mirrored?: No
+
+Within Plots:
+  Permutation type: series
+  Mirrored?: Yes
+  Different permutation within each Plot?: Yes
+
+Permutation details:
+  Number of permutations requested: 199
+  Max. number of permutations allowed: 9999
+  Evaluate all permutations?: No.  Activation limit: 99
+> ## ... or switch the type of shuffling at a level:
+> update(h1, plots = update(getPlots(h1), type = "none"))
+
+Permutation Design:
+
+Blocks:
+  Blocks: blks
+
+Plots:
+  Plots: plts
+  Permutation type: none
+  Mirrored?: No
+
+Within Plots:
+  Permutation type: series
+  Mirrored?: Yes
+  Different permutation within each Plot?: Yes
+
+Permutation details:
+  Number of permutations requested: 199
+  Max. number of permutations allowed: 9999
+  Evaluate all permutations?: No.  Activation limit: 99
+> 
+> 
+> 
+> cleanEx()
 > nameEx("jackal")
 > ### * jackal
 > 
@@ -291,188 +688,6 @@
 > 
 > 
 > cleanEx()
-> nameEx("permCheck")
-> ### * permCheck
-> 
-> flush(stderr()); flush(stdout())
-> 
-> ### Name: check
-> ### Title: Utility functions for permutation schemes
-> ### Aliases: check permCheck print.check print.summary.check summary.check
-> ###   permuplot
-> ### Keywords: utilities design methods
-> 
-> ### ** Examples
-> 
-> 
-> ## Not run: 
-> ##D  ##D 
-> ##D ## use example data from ?pyrifos in package vegan
-> ##D require(vegan)
-> ##D example(pyrifos)
-> ##D 
-> ##D ## Demonstrate the maximum number of permutations for the pyrifos data
-> ##D ## under a series of permutation schemes
-> ##D 
-> ##D ## no restrictions - lots of perms
-> ##D CONTROL <- how(within = Within(type = "free"))
-> ##D (check1 <- check(pyrifos, CONTROL))
-> ##D ##summary(check1)
-> ##D 
-> ##D ## no strata but data are series with no mirroring, so 132 permutations
-> ##D CONTROL <- how(within = Within(type = "series",
-> ##D                                        mirror = FALSE))
-> ##D check(pyrifos, CONTROL)
-> ##D 
-> ##D ## no strata but data are series with mirroring, so 264 permutations
-> ##D CONTROL <- how(within = Within(type = "series",
-> ##D                                        mirror = TRUE))
-> ##D check(pyrifos, control = CONTROL)
-> ##D 
-> ##D ## unrestricted within strata
-> ##D check(pyrifos, control = how(strata = ditch,
-> ##D                    within = Within(type = "free")))
-> ##D 
-> ##D ## time series within strata, no mirroring
-> ##D check(pyrifos, control = how(strata = ditch,
-> ##D                    within = Within(type = "series",
-> ##D                                                   mirror = FALSE)))
-> ##D 
-> ##D ## time series within strata, with mirroring
-> ##D check(pyrifos, control = how(strata = ditch,
-> ##D                    within = Within(type = "series",
-> ##D                                                   mirror = TRUE)))
-> ##D 
-> ##D ## time series within strata, no mirroring, same permutation
-> ##D ## within strata
-> ##D check(pyrifos, control = how(strata = ditch,
-> ##D                    within = Within(type = "series",
-> ##D                                    constant = TRUE)))
-> ##D 
-> ##D ## time series within strata, with mirroring, same permutation
-> ##D ## within strata
-> ##D check(pyrifos, control = how(strata = ditch,
-> ##D                    within = Within(type = "series",
-> ##D                                                   mirror = TRUE,
-> ##D                                                   constant = TRUE)))
-> ##D 
-> ##D ## permute strata
-> ##D check(pyrifos, how(strata = ditch,
-> ##D                                within = Within(type = "none"),
-> ##D                                blocks = Blocks(type = "free")))
-> ## End(Not run)
-> 
-> ## Not run: 
-> ##D  ##D 
-> ##D ## this should also also for arbitrary vectors
-> ##D vec1 <- check(1:100)
-> ##D vec2 <- check(1:100, how())
-> ##D all.equal(vec1, vec2)
-> ##D vec3 <- check(1:100, how(within = Within(type = "series")))
-> ##D all.equal(100, vec3$n)
-> ##D vec4 <- check(1:100, how(within =
-> ##D                                      Within(type= "series",
-> ##D                                                 mirror = TRUE)))
-> ##D all.equal(vec4$n, 200)
-> ##D 
-> ##D ## enumerate all possible permutations
-> ##D fac <- gl(2,6)
-> ##D ctrl <- how(strata = fac,
-> ##D                     within = Within(type = "grid", mirror = FALSE,
-> ##D                                     constant = TRUE, nrow = 3,
-> ##D                                     ncol = 2))
-> ##D check(1:12, ctrl)
-> ##D 
-> ##D numPerms(1:12, control = ctrl)
-> ##D (tmp <- allPerms(12, control = ctrl, observed = TRUE))
-> ##D (tmp2 <- allPerms(12, control = ctrl))
-> ##D 
-> ##D ## turn on mirroring ##D 
-> ##D ctrl$within$mirror <- TRUE
-> ##D numPerms(1:12, control = ctrl)
-> ##D (tmp3 <- allPerms(12, control = ctrl, observed = TRUE))
-> ##D (tmp4 <- allPerms(12, control = ctrl))
-> ##D ## prints out details of the permutation scheme as
-> ##D ## well as the matrix of permutations
-> ##D ##summary(tmp) ##D 
-> ##D ##summary(tmp2)
-> ## End(Not run)
-> 
-> ## Not run: 
-> ##D ## different numbers of observations per level of strata
-> ##D fac <- factor(rep(1:3, times = c(3,2,2)))
-> ##D ## free permutations in levels of strata
-> ##D numPerms(7, how(type = "free", strata = fac))
-> ##D allPerms(7, how(type = "free", strata = fac))
-> ##D ## series permutations in levels of strata
-> ##D numPerms(7, how(type = "series", strata = fac))
-> ##D allPerms(7, how(type = "series", strata = fac))
-> ##D 
-> ##D ## allPerms can work with a vector
-> ##D vec <- c(3,4,5)
-> ##D allPerms(vec)
-> ##D 
-> ##D ## Tests for permuplot
-> ##D n <- 25
-> ##D ## standard permutation designs
-> ##D permuplot(n, how(type = "free"))
-> ##D permuplot(n, how(type = "series"))
-> ##D permuplot(n, how(type = "grid", nrow = 5, ncol = 5))
-> ##D 
-> ##D ## restricted perms with mirroring
-> ##D permuplot(n, how(type = "series", mirror = TRUE))
-> ##D permuplot(n, how(type = "grid", nrow = 5, ncol = 5,
-> ##D                              mirror = TRUE))
-> ##D 
-> ##D ## perms within strata
-> ##D fac <- gl(6, 20)
-> ##D control <- how(type = "free", strata = fac)
-> ##D permuplot(120, control = control, cex = 0.8)
-> ##D control <- how(type = "series", strata = fac)
-> ##D permuplot(120, control = control, cex = 0.8)
-> ##D fac <- gl(6, 25)
-> ##D control <- how(type = "grid", strata = fac,
-> ##D                        nrow = 5, ncol = 5)
-> ##D permuplot(150, control = control, cex = 0.8)
-> ##D 
-> ##D ## perms within strata with mirroring
-> ##D fac <- gl(6, 20)
-> ##D control <- how(type = "series", strata = fac,
-> ##D                        mirror = TRUE)
-> ##D permuplot(120, control = control, cex = 0.8)
-> ##D fac <- gl(6, 25)
-> ##D control <- how(type = "grid", strata = fac,
-> ##D                        nrow = 5, ncol = 5, mirror = TRUE)
-> ##D permuplot(150, control = control, cex = 0.8)
-> ##D 
-> ##D ## same perms within strata
-> ##D fac <- gl(6, 20)
-> ##D control <- how(type = "free", strata = fac,
-> ##D                        constant = TRUE)
-> ##D permuplot(120, control = control, cex = 0.8)
-> ##D control <- how(type = "series", strata = fac,
-> ##D                        constant = TRUE)
-> ##D permuplot(120, control = control, cex = 0.8)
-> ##D fac <- gl(6, 25)
-> ##D control <- how(type = "grid", strata = fac,
-> ##D                        nrow = 5, ncol = 5, constant = TRUE)
-> ##D permuplot(150, control = control, cex = 0.8)
-> ##D 
-> ##D ## same perms within strata with mirroring
-> ##D fac <- gl(6, 20)
-> ##D control <- how(type = "series", strata = fac,
-> ##D                        mirror = TRUE, constant = TRUE)
-> ##D permuplot(120, control = control, cex = 0.8)
-> ##D fac <- gl(6, 25)
-> ##D control <- how(type = "grid", strata = fac,
-> ##D                        nrow = 5, ncol = 5, mirror = TRUE,
-> ##D                        constant = TRUE)
-> ##D permuplot(150, control = control, cex = 0.8)
-> ## End(Not run)
-> 
-> 
-> 
-> cleanEx()
 > nameEx("shuffle-utils")
 > ### * shuffle-utils
 > 
@@ -563,22 +778,22 @@
 > plots <- Plots(strata = gl(4, 5))
 > CTRL <- how(plots = plots, within = Within(type = "free"))
 > shuffle(20, CTRL)
- [1]  8 10  6  7  9  3  5  2  1  4 19 16 20 17 18 13 12 11 14 15
+ [1]  5  3  4  2  1  8  7  6  9 10 14 11 15 12 13 18 20 16 17 19
 > ## as above but same random permutation within strata
 > CTRL <- how(plots = plots, within = Within(type = "free",
 +             constant = TRUE))
 > shuffle(20, CTRL)
- [1]  8  7 10  6  9 13 12 15 11 14 18 17 20 16 19  3  2  5  1  4
+ [1]  3  5  2  1  4  8 10  7  6  9 13 15 12 11 14 18 20 17 16 19
 > 
 > ## time series within each level of block
 > CTRL <- how(plots = plots, within = Within(type = "series"))
 > shuffle(20, CTRL)
- [1]  5  1  2  3  4 17 18 19 20 16 14 15 11 12 13  8  9 10  6  7
+ [1]  2  3  4  5  1  8  9 10  6  7 15 11 12 13 14 19 20 16 17 18
 > ## as above, but  with same permutation for each level
 > CTRL <- how(plots = plots, within = Within(type = "series",
 +             constant = TRUE))
 > shuffle(20, CTRL)
- [1]  2  3  4  5  1 12 13 14 15 11 17 18 19 20 16  7  8  9 10  6
+ [1]  2  3  4  5  1  7  8  9 10  6 12 13 14 15 11 17 18 19 20 16
 > 
 > ## spatial grids within each level of block, 4 x (5r x 5c)
 > nr <- 5
@@ -588,23 +803,23 @@
 > CTRL <- how(plots = plots,
 +             within = Within(type = "grid", ncol = nc, nrow = nr))
 > shuffle(100, CTRL)
-  [1]   9  10   6   7   8  14  15  11  12  13  19  20  16  17  18  24  25  21
- [19]  22  23   4   5   1   2   3  83  84  85  81  82  88  89  90  86  87  93
- [37]  94  95  91  92  98  99 100  96  97  78  79  80  76  77  34  35  31  32
- [55]  33  39  40  36  37  38  44  45  41  42  43  49  50  46  47  48  29  30
- [73]  26  27  28  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75
- [91]  51  52  53  54  55  56  57  58  59  60
+  [1]  24  25  21  22  23   4   5   1   2   3   9  10   6   7   8  14  15  11
+ [19]  12  13  19  20  16  17  18  27  28  29  30  26  32  33  34  35  31  37
+ [37]  38  39  40  36  42  43  44  45  41  47  48  49  50  46  56  57  58  59
+ [55]  60  61  62  63  64  65  66  67  68  69  70  71  72  73  74  75  51  52
+ [73]  53  54  55  83  84  85  81  82  88  89  90  86  87  93  94  95  91  92
+ [91]  98  99 100  96  97  78  79  80  76  77
 > ## as above, but with same permutation for each level
 > CTRL <- how(plots = plots,
 +             within = Within(type = "grid", ncol = nc, nrow = nr,
 +                             constant = TRUE))
 > shuffle(100, CTRL)
-  [1]  17  18  19  20  16  22  23  24  25  21   2   3   4   5   1   7   8   9
- [19]  10   6  12  13  14  15  11  67  68  69  70  66  72  73  74  75  71  52
- [37]  53  54  55  51  57  58  59  60  56  62  63  64  65  61  92  93  94  95
- [55]  91  97  98  99 100  96  77  78  79  80  76  82  83  84  85  81  87  88
- [73]  89  90  86  42  43  44  45  41  47  48  49  50  46  27  28  29  30  26
- [91]  32  33  34  35  31  37  38  39  40  36
+  [1]  23  24  25  21  22   3   4   5   1   2   8   9  10   6   7  13  14  15
+ [19]  11  12  18  19  20  16  17  48  49  50  46  47  28  29  30  26  27  33
+ [37]  34  35  31  32  38  39  40  36  37  43  44  45  41  42  73  74  75  71
+ [55]  72  53  54  55  51  52  58  59  60  56  57  63  64  65  61  62  68  69
+ [73]  70  66  67  98  99 100  96  97  78  79  80  76  77  83  84  85  81  82
+ [91]  88  89  90  86  87  93  94  95  91  92
 > 
 > ## permuting levels of plots instead of observations
 > CTRL <- how(plots = Plots(gl(4, 5), type = "free"),
@@ -623,13 +838,13 @@
 > CTRL <- how(plots = Plots(gl(4, 5), type = "series"),
 +             within = Within(type = "free"))
 > shuffle(20, CTRL)
- [1] 15 11 14 12 13 17 16 18 20 19  5  4  2  1  3  6  7 10  9  8
+ [1]  2  1  3  4  5  6 10  9  7  8 11 12 13 14 15 16 18 20 17 19
 > 
 > ## permuting within blocks
 > grp <- gl(2, 10) # 2 groups of 10 samples each
 > CTRL <- how(blocks = grp)
 > shuffle(length(grp), control = CTRL)
- [1]  6  5  3  7  4  1  2  8  9 10 16 20 17 14 19 12 15 18 13 11
+ [1]  1  3  6 10  4  2  7  8  9  5 12 14 11 15 18 17 16 19 20 13
 > 
 > ## Simple function using permute() to assess significance
 > ## of a t.test  
@@ -720,48 +935,48 @@
 > ### ** Examples
 > 
 > ## simple random permutations, 5 permutations in set
-> shuffleSet(n = 10, nset = 10)
-      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
- [1,]    3    4    5    7    2    8    9    6   10     1
- [2,]    3    2    6   10    5    7    8    4    1     9
- [3,]   10    2    6    1    9    8    7    5    3     4
- [4,]    5    6    4    2   10    8    9    1    7     3
- [5,]    9    6    7    4    8   10    1    2    3     5
- [6,]    5    8    4    2    1    6    7    9    3    10
- [7,]   10    3    4    9    8    2    5    7    1     6
- [8,]    4    8    3    9    7    5   10    2    6     1
- [9,]    5    7    4    3   10    2    9    1    8     6
-[10,]    3    1    6    7    5    4    2    8   10     9
+> shuffleSet(n = 10, nset = 5)
+     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
+[1,]    3    4    5    7    2    8    9    6   10     1
+[2,]    3    2    6   10    5    7    8    4    1     9
+[3,]   10    2    6    1    9    8    7    5    3     4
+[4,]    5    6    4    2   10    8    9    1    7     3
+[5,]    9    6    7    4    8   10    1    2    3     5
 > 
-> ## series random permutations, 10 permutations in set
-> shuffleSet(10, 10, how(within = Within(type = "series")))
-      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
- [1,]    8    9   10    1    2    3    4    5    6     7
- [2,]    5    6    7    8    9   10    1    2    3     4
- [3,]    4    5    6    7    8    9   10    1    2     3
- [4,]    1    2    3    4    5    6    7    8    9    10
- [5,]    8    9   10    1    2    3    4    5    6     7
- [6,]    4    5    6    7    8    9   10    1    2     3
- [7,]    3    4    5    6    7    8    9   10    1     2
- [8,]    6    7    8    9   10    1    2    3    4     5
- [9,]    1    2    3    4    5    6    7    8    9    10
-[10,]    7    8    9   10    1    2    3    4    5     6
+> ## series random permutations, 5 permutations in set
+> shuffleSet(10, 5, how(within = Within(type = "series")),
++            check = FALSE)
+     [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
+[1,]    6    7    8    9   10    1    2    3    4     5
+[2,]   10    1    2    3    4    5    6    7    8     9
+[3,]    6    7    8    9   10    1    2    3    4     5
+[4,]    4    5    6    7    8    9   10    1    2     3
+[5,]    2    3    4    5    6    7    8    9   10     1
 > 
 > ## series random permutations, 10 permutations in set,
 > ## with possible mirroring
 > CTRL <- how(within = Within(type = "series", mirror = TRUE))
 > shuffleSet(10, 10, CTRL)
       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
- [1,]    1    2    3    4    5    6    7    8    9    10
- [2,]    4    3    2    1   10    9    8    7    6     5
- [3,]    2    1   10    9    8    7    6    5    4     3
- [4,]    8    7    6    5    4    3    2    1   10     9
+ [1,]    2    3    4    5    6    7    8    9   10     1
+ [2,]    3    4    5    6    7    8    9   10    1     2
+ [3,]    4    5    6    7    8    9   10    1    2     3
+ [4,]    5    6    7    8    9   10    1    2    3     4
  [5,]    6    7    8    9   10    1    2    3    4     5
- [6,]   10    9    8    7    6    5    4    3    2     1
- [7,]    5    4    3    2    1   10    9    8    7     6
- [8,]    8    7    6    5    4    3    2    1   10     9
- [9,]    6    5    4    3    2    1   10    9    8     7
-[10,]    4    5    6    7    8    9   10    1    2     3
+ [6,]    7    8    9   10    1    2    3    4    5     6
+ [7,]    8    9   10    1    2    3    4    5    6     7
+ [8,]    9   10    1    2    3    4    5    6    7     8
+ [9,]   10    1    2    3    4    5    6    7    8     9
+[10,]    1   10    9    8    7    6    5    4    3     2
+[11,]    2    1   10    9    8    7    6    5    4     3
+[12,]    3    2    1   10    9    8    7    6    5     4
+[13,]    4    3    2    1   10    9    8    7    6     5
+[14,]    5    4    3    2    1   10    9    8    7     6
+[15,]    6    5    4    3    2    1   10    9    8     7
+[16,]    7    6    5    4    3    2    1   10    9     8
+[17,]    8    7    6    5    4    3    2    1   10     9
+[18,]    9    8    7    6    5    4    3    2    1    10
+[19,]   10    9    8    7    6    5    4    3    2     1
 > 
 > ## Permuting strata
 > ## 4 groups of 5 observations
@@ -769,27 +984,53 @@
 +             plots = Plots(strata = gl(4,5), type = "free"))
 > shuffleSet(20, 10, control = CTRL)
       [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13]
- [1,]   11   12   13   14   15    1    2    3    4     5    16    17    18
- [2,]   16   17   18   19   20    6    7    8    9    10    11    12    13
- [3,]   16   17   18   19   20    6    7    8    9    10    11    12    13
+ [1,]    1    2    3    4    5    6    7    8    9    10    16    17    18
+ [2,]    1    2    3    4    5   11   12   13   14    15     6     7     8
+ [3,]    1    2    3    4    5   11   12   13   14    15    16    17    18
  [4,]    1    2    3    4    5   16   17   18   19    20     6     7     8
- [5,]    1    2    3    4    5   11   12   13   14    15    16    17    18
- [6,]   11   12   13   14   15    6    7    8    9    10     1     2     3
- [7,]   11   12   13   14   15    1    2    3    4     5     6     7     8
- [8,]    6    7    8    9   10    1    2    3    4     5    11    12    13
+ [5,]    1    2    3    4    5   16   17   18   19    20    11    12    13
+ [6,]    6    7    8    9   10    1    2    3    4     5    11    12    13
+ [7,]    6    7    8    9   10    1    2    3    4     5    16    17    18
+ [8,]    6    7    8    9   10   11   12   13   14    15     1     2     3
  [9,]    6    7    8    9   10   11   12   13   14    15    16    17    18
-[10,]    1    2    3    4    5    6    7    8    9    10    11    12    13
+[10,]    6    7    8    9   10   16   17   18   19    20     1     2     3
+[11,]    6    7    8    9   10   16   17   18   19    20    11    12    13
+[12,]   11   12   13   14   15    1    2    3    4     5     6     7     8
+[13,]   11   12   13   14   15    1    2    3    4     5    16    17    18
+[14,]   11   12   13   14   15    6    7    8    9    10     1     2     3
+[15,]   11   12   13   14   15    6    7    8    9    10    16    17    18
+[16,]   11   12   13   14   15   16   17   18   19    20     1     2     3
+[17,]   11   12   13   14   15   16   17   18   19    20     6     7     8
+[18,]   16   17   18   19   20    1    2    3    4     5     6     7     8
+[19,]   16   17   18   19   20    1    2    3    4     5    11    12    13
+[20,]   16   17   18   19   20    6    7    8    9    10     1     2     3
+[21,]   16   17   18   19   20    6    7    8    9    10    11    12    13
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/vegan -r 2672


More information about the Vegan-commits mailing list