Skip to content

Commit

Permalink
Merge branch 'issue-25':
Browse files Browse the repository at this point in the history
These commits fix issues related to the use of a new, default, RNG method
in R-devel (to be 3.6.x), which was causing failures in unit tests and
differences in outputs of examples/vignettes etc. This is fixed temporarily
here. A broader fix might be to require R >= 3.6.0 when it is released.
Closes #25
  • Loading branch information
gavinsimpson committed Mar 10, 2019
2 parents 9261afb + 81eb79c commit 351b1f4
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 9 deletions.
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
language: r
cache: packages

r:
- release
- devel
matrix:
include:
- r: devel
- r: release

sudo: false

Expand All @@ -22,7 +23,7 @@ r_binary_packages:
- htmltools

r_github_packages:
- jimhester/covr
- r-lib/covr

after_success:
- Rscript -e 'covr::codecov()'
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: permute
Title: Functions for Generating Restricted Permutations of Data
Version: 0.9-4
Date: 2016-08-08
Version: 0.9-5
Date: 2019-03-10
Authors@R: c(person(given = "Gavin L.", family = "Simpson",
email = "[email protected]",
role = c("aut", "cph", "cre"),
Expand Down
2 changes: 2 additions & 0 deletions man/nobs.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
}
\author{Gavin Simpson}
\examples{
\dontshow{suppressWarnings(RNGversion("3.5.0"))}
set.seed(1)
## numeric vector
len <- sample(1:10, 1)
v <- as.numeric(sample(1:100, len))
Expand Down
1 change: 1 addition & 0 deletions man/shuffle-utils.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ shuffleStrata(strata, type, mirror = FALSE, start = NULL, flip = NULL,
wrapper to these functions.}

\examples{
\dontshow{suppressWarnings(RNGversion("3.5.0"))}
set.seed(3)

## draw 1 value at random from the set 1:10
Expand Down
1 change: 1 addition & 0 deletions man/shuffle.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ permute(i, n, control)
permutation scheme described by \code{\link{how}}.}

\examples{
\dontshow{suppressWarnings(RNGversion("3.5.0"))}
set.seed(1234)

## unrestricted permutations
Expand Down
2 changes: 2 additions & 0 deletions man/shuffleSet.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ shuffleSet(n, nset, control = how(), check = TRUE, quietly = FALSE)
\code{\link{how}} for setting up permutation designs.
}
\examples{
\dontshow{suppressWarnings(RNGversion("3.5.0"))}
set.seed(1)
## simple random permutations, 5 permutations in set
shuffleSet(n = 10, nset = 5)

Expand Down
22 changes: 19 additions & 3 deletions tests/Examples/permute-Ex.Rout.save
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

R version 3.3.0 Patched (2016-05-12 r70603) -- "Supposedly Educational"
Copyright (C) 2016 The R Foundation for Statistical Computing
R version 3.5.3 beta (2019-02-28 r76174) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
Expand All @@ -23,6 +23,7 @@ Type 'q()' to quit R.
> library('permute')
>
> base::assign(".oldSearch", base::search(), pos = 'CheckExEnv')
> base::assign(".old_wd", base::getwd(), pos = 'CheckExEnv')
> cleanEx()
> nameEx("allPerms")
> ### * allPerms
Expand Down Expand Up @@ -643,6 +644,10 @@ Permutation details:
>
> ### ** Examples
>
> ## Don't show:
> suppressWarnings(RNGversion("3.5.0"))
> ## End(Don't show)
> set.seed(1)
> ## numeric vector
> len <- sample(1:10, 1)
> v <- as.numeric(sample(1:100, len))
Expand Down Expand Up @@ -768,6 +773,9 @@ Permutation details:
>
> ### ** Examples
>
> ## Don't show:
> suppressWarnings(RNGversion("3.5.0"))
> ## End(Don't show)
> set.seed(3)
>
> ## draw 1 value at random from the set 1:10
Expand Down Expand Up @@ -809,6 +817,9 @@ Permutation details:
>
> ### ** Examples
>
> ## Don't show:
> suppressWarnings(RNGversion("3.5.0"))
> ## End(Don't show)
> set.seed(1234)
>
> ## unrestricted permutations
Expand Down Expand Up @@ -1001,6 +1012,10 @@ mean in group Group 1 mean in group Group 2
>
> ### ** Examples
>
> ## Don't show:
> suppressWarnings(RNGversion("3.5.0"))
> ## End(Don't show)
> set.seed(1)
> ## simple random permutations, 5 permutations in set
> shuffleSet(n = 10, nset = 5)
No. of Permutations: 5
Expand Down Expand Up @@ -1155,9 +1170,10 @@ p4 5 1 2 3 4 10 6 7 8 9 15 11 12 13 14 20 16 17 18 19
>
> ### * <FOOTER>
> ###
> cleanEx()
> options(digits = 7L)
> base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
Time elapsed: 4.459 0.081 4.542 0 0
Time elapsed: 3.78 0.067 3.873 0 0
> grDevices::dev.off()
null device
1
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-shuffle.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ test_that("shuffle() works for non-contigous blocks of samples", {
CTRL <- how(plots = Plots(strata = Plot, type = "free"),
within = Within(type = "none"))
n <- 20
## FIXME Temporary fix related to #25
suppressWarnings(RNGversion("3.5.0"))
set.seed(2)
result <- shuffle(n, CTRL)
out1 <- as.integer(c( 3, 2, 1, 4,
Expand Down
1 change: 1 addition & 0 deletions vignettes/permutations.Rnw
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<<preliminary,results=hide,echo=false>>=
options("prompt" = "R> ", "continue" = "+ ")
options(useFancyQuotes="UTF-8")
suppressWarnings(RNGversion("3.5.0"))
@
\section{Introduction}
In classical frequentist statistics, the significance of a relationship or model is determined by reference to a null distribution for the test statistic. This distribution is derived mathematically and the probability of achieving a test statistic as large or larger if the null hypothesis were true is looked-up from this null distribution. In deriving this probability, some assumptions about the data or the errors are made. If these assumptions are violated, then the validity of the derived $p$-value may be questioned.
Expand Down

0 comments on commit 351b1f4

Please sign in to comment.