diff --git a/.Rbuildignore b/.Rbuildignore index 889bcdc..b761d0a 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -28,3 +28,5 @@ NEWS\.tex .*_snaps.* ^Meta$ ^CNAME$ +^_pkgdown\.yml$ +^\.github$ diff --git a/DESCRIPTION b/DESCRIPTION index 5c6dd97..6dc239f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -40,10 +40,10 @@ Imports: tools, graphics, rlang, + uuid (>= 1.0-3), knitr (>= 1.19) Suggests: testthat (>= 3.0.0), - uuid (>= 1.0-3), writexl (>= 1.5.0), glue (>= 1.6.0), httr (>= 1.4.0), diff --git a/R/class_random_block_size_randomizer.R b/R/class_random_block_size_randomizer.R index 4b92586..f2fb50e 100644 --- a/R/class_random_block_size_randomizer.R +++ b/R/class_random_block_size_randomizer.R @@ -30,6 +30,7 @@ #' #' @param blockSizes List of block size configurations, each mapping treatment arm IDs to sizes. #' @param seed Integer random seed used for reproducibility. +#' @param ... Additional arguments (currently unused). #' #' @return A `RandomBlockSizeRandomizer` reference class object. #' diff --git a/R/f_random_stratum_builder.R b/R/f_random_stratum_builder.R index 19db164..65d6f9a 100644 --- a/R/f_random_stratum_builder.R +++ b/R/f_random_stratum_builder.R @@ -55,7 +55,7 @@ createStratumId <- function(factorLevels) { ) } - factorLevel <- factorLevels.get(factorName) + factorLevel <- factorLevels[[factorName]] if (is.null(factorLevel) || nchar(trimws(factorLevel)) == 0) { stop("The specified factor level (#", counter, ") is invalid") } diff --git a/R/f_seed.R b/R/f_seed.R index 82b20c2..722fdac 100644 --- a/R/f_seed.R +++ b/R/f_seed.R @@ -78,15 +78,11 @@ #' is better than the pseudo-random number algorithms typically used #' in computer programs. For more information see \url{https://www.random.org}. #' -#' @seealso \link{getSimulatedTwoArmMeans} -#' #' @return an integer value or vector containing one or more seeds. #' #' @export #' createSeed <- function(numberOfValues = 1, minValue = 1000000, maxValue = 9999999, ...) { - .assertPackageIsInstalled("httr") - .assertPackageIsInstalled("glue") .assertIsSingleInteger(numberOfValues, "numberOfValues", validateType = FALSE) .assertIsInClosedInterval(numberOfValues, "numberOfValues", lower = 1, upper = 1000) .assertIsSingleInteger(minValue, "minValue", validateType = FALSE) @@ -97,8 +93,12 @@ createSeed <- function(numberOfValues = 1, minValue = 1000000, maxValue = 999999 stop(C_EXCEPTION_TYPE_CONFLICTING_ARGUMENTS, "'minValue' (", minValue, ") ", "must be smaller than argument 'maxValue'(", maxValue, ")") } + tryCatch( { + .assertPackageIsInstalled("httr") + .assertPackageIsInstalled("glue") + args <- list(...) if (length(args) > 0 && !is.null(args[["test_exception"]])) { stop(args[["test_exception"]]) diff --git a/man/createSeed.Rd b/man/createSeed.Rd index e3b9d91..5fa800d 100644 --- a/man/createSeed.Rd +++ b/man/createSeed.Rd @@ -27,6 +27,3 @@ The randomness comes from atmospheric noise, which for many purposes is better than the pseudo-random number algorithms typically used in computer programs. For more information see \url{https://www.random.org}. } -\seealso{ -\link{getSimulatedTwoArmMeans} -} diff --git a/man/getRandomBlockSizeRandomizer.Rd b/man/getRandomBlockSizeRandomizer.Rd index 9d9fe13..9e4674c 100644 --- a/man/getRandomBlockSizeRandomizer.Rd +++ b/man/getRandomBlockSizeRandomizer.Rd @@ -9,6 +9,8 @@ getRandomBlockSizeRandomizer(blockSizes, ..., seed = NA_integer_) \arguments{ \item{blockSizes}{List of block size configurations, each mapping treatment arm IDs to sizes.} +\item{...}{Additional arguments (currently unused).} + \item{seed}{Integer random seed used for reproducibility.} } \value{ diff --git a/tests/testthat/test_f_seed.R b/tests/testthat/test_f_seed.R index 751b2e9..a6dc603 100644 --- a/tests/testthat/test_f_seed.R +++ b/tests/testthat/test_f_seed.R @@ -21,6 +21,9 @@ # ------------------------------------------------------------------------------ test_that("For invalid input arguments 'createSeed' throws meaningful exceptions", { + testthat::skip_if_not_installed("httr") + testthat::skip_if_not_installed("glue") + expect_error(createSeed(numberOfValues = 0), "Argument out of bounds: 'numberOfValues' (0) is out of bounds [1; 1000]", fixed = TRUE) expect_error(createSeed(numberOfValues = 1, minValue = -1), @@ -32,6 +35,9 @@ test_that("For invalid input arguments 'createSeed' throws meaningful exceptions }) test_that("The results of 'createSeed' depend on the input arguments as expected", { + testthat::skip_if_not_installed("httr") + testthat::skip_if_not_installed("glue") + expect_length(createSeed(), 1) expect_length(createSeed(numberOfValues = 9), 9) @@ -41,6 +47,9 @@ test_that("The results of 'createSeed' depend on the input arguments as expected }) test_that("'createSeed' returns valid seed although network connection is missing", { + testthat::skip_if_not_installed("httr") + testthat::skip_if_not_installed("glue") + expect_warning(seed <- createSeed( minValue = 100000000, maxValue = 999999999, test_exception = "network error"