Skip to content

Commit 57323aa

Browse files
authored
Merge pull request #1 from RCONIS/dev/friedrich_pahlke
Add uuid, glue, and httr to R dependencies in workflow configuration
2 parents 38c9fc6 + 2acd954 commit 57323aa

File tree

8 files changed

+20
-9
lines changed

8 files changed

+20
-9
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ NEWS\.tex
2828
.*_snaps.*
2929
^Meta$
3030
^CNAME$
31+
^_pkgdown\.yml$
32+
^\.github$

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ Imports:
4040
tools,
4141
graphics,
4242
rlang,
43+
uuid (>= 1.0-3),
4344
knitr (>= 1.19)
4445
Suggests:
4546
testthat (>= 3.0.0),
46-
uuid (>= 1.0-3),
4747
writexl (>= 1.5.0),
4848
glue (>= 1.6.0),
4949
httr (>= 1.4.0),

R/class_random_block_size_randomizer.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#'
3131
#' @param blockSizes List of block size configurations, each mapping treatment arm IDs to sizes.
3232
#' @param seed Integer random seed used for reproducibility.
33+
#' @param ... Additional arguments (currently unused).
3334
#'
3435
#' @return A `RandomBlockSizeRandomizer` reference class object.
3536
#'

R/f_random_stratum_builder.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ createStratumId <- function(factorLevels) {
5555
)
5656
}
5757

58-
factorLevel <- factorLevels.get(factorName)
58+
factorLevel <- factorLevels[[factorName]]
5959
if (is.null(factorLevel) || nchar(trimws(factorLevel)) == 0) {
6060
stop("The specified factor level (#", counter, ") is invalid")
6161
}

R/f_seed.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,11 @@
7878
#' is better than the pseudo-random number algorithms typically used
7979
#' in computer programs. For more information see \url{https://www.random.org}.
8080
#'
81-
#' @seealso \link{getSimulatedTwoArmMeans}
82-
#'
8381
#' @return an integer value or vector containing one or more seeds.
8482
#'
8583
#' @export
8684
#'
8785
createSeed <- function(numberOfValues = 1, minValue = 1000000, maxValue = 9999999, ...) {
88-
.assertPackageIsInstalled("httr")
89-
.assertPackageIsInstalled("glue")
9086
.assertIsSingleInteger(numberOfValues, "numberOfValues", validateType = FALSE)
9187
.assertIsInClosedInterval(numberOfValues, "numberOfValues", lower = 1, upper = 1000)
9288
.assertIsSingleInteger(minValue, "minValue", validateType = FALSE)
@@ -97,8 +93,12 @@ createSeed <- function(numberOfValues = 1, minValue = 1000000, maxValue = 999999
9793
stop(C_EXCEPTION_TYPE_CONFLICTING_ARGUMENTS, "'minValue' (", minValue, ") ",
9894
"must be smaller than argument 'maxValue'(", maxValue, ")")
9995
}
96+
10097
tryCatch(
10198
{
99+
.assertPackageIsInstalled("httr")
100+
.assertPackageIsInstalled("glue")
101+
102102
args <- list(...)
103103
if (length(args) > 0 && !is.null(args[["test_exception"]])) {
104104
stop(args[["test_exception"]])

man/createSeed.Rd

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/getRandomBlockSizeRandomizer.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test_f_seed.R

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
# ------------------------------------------------------------------------------
2222

2323
test_that("For invalid input arguments 'createSeed' throws meaningful exceptions", {
24+
testthat::skip_if_not_installed("httr")
25+
testthat::skip_if_not_installed("glue")
26+
2427
expect_error(createSeed(numberOfValues = 0),
2528
"Argument out of bounds: 'numberOfValues' (0) is out of bounds [1; 1000]", fixed = TRUE)
2629
expect_error(createSeed(numberOfValues = 1, minValue = -1),
@@ -32,6 +35,9 @@ test_that("For invalid input arguments 'createSeed' throws meaningful exceptions
3235
})
3336

3437
test_that("The results of 'createSeed' depend on the input arguments as expected", {
38+
testthat::skip_if_not_installed("httr")
39+
testthat::skip_if_not_installed("glue")
40+
3541
expect_length(createSeed(), 1)
3642
expect_length(createSeed(numberOfValues = 9), 9)
3743

@@ -41,6 +47,9 @@ test_that("The results of 'createSeed' depend on the input arguments as expected
4147
})
4248

4349
test_that("'createSeed' returns valid seed although network connection is missing", {
50+
testthat::skip_if_not_installed("httr")
51+
testthat::skip_if_not_installed("glue")
52+
4453
expect_warning(seed <- createSeed(
4554
minValue = 100000000, maxValue = 999999999,
4655
test_exception = "network error"

0 commit comments

Comments
 (0)