R Under development (unstable) (2023-12-19 r85710 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > source("incl/start.R") Loading required package: foreach Loading required package: future R Under development (unstable) (2023-12-19 r85710 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows Server 2022 x64 (build 20348) Matrix products: default locale: [1] LC_COLLATE=C LC_CTYPE=German_Germany.utf8 [3] LC_MONETARY=C LC_NUMERIC=C [5] LC_TIME=C time zone: Europe/Berlin tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] doFuture_1.0.1 future_1.33.0 foreach_1.5.2 loaded via a namespace (and not attached): [1] compiler_4.4.0 parallelly_1.36.0 tools_4.4.0 [4] parallel_4.4.0 future.apply_1.11.0 listenv_0.9.0 [7] codetools_0.2-19 iterators_1.0.14 digest_0.6.33 [10] globals_0.16.2 > > future_version <- doFuture:::future_version > hpaste <- doFuture:::hpaste > mdebug <- doFuture:::mdebug > mdebugf <- doFuture:::mdebugf > mprint <- doFuture:::mprint > mstr <- doFuture:::mstr > stealth_sample.int <- doFuture:::stealth_sample.int > stop_if_not <- doFuture:::stop_if_not > printf <- function(...) cat(sprintf(...)) > > message("*** utils ...") *** utils ... > > message("*** future_version() ...") *** future_version() ... > > ver <- future_version() > print(ver) [1] '1.33.0' > stopifnot(inherits(ver, "package_version")) > > message("*** future_version() ... DONE") *** future_version() ... DONE > > message("*** hpaste() ...") *** hpaste() ... > > # Some vectors > x <- 1:6 > y <- 10:1 > z <- LETTERS[x] > > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > # Abbreviation of output vector > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - > printf("x = %s.\n", hpaste(x)) x = 1, 2, 3, 4, 5, 6. > ## x = 1, 2, 3, ..., 6. > > printf("x = %s.\n", hpaste(x, maxHead = 2)) x = 1, 2, ..., 6. > ## x = 1, 2, ..., 6. > > printf("x = %s.\n", hpaste(x, maxHead = 3)) # Default x = 1, 2, 3, ..., 6. > ## x = 1, 2, 3, ..., 6. > > # It will never output 1, 2, 3, 4, ..., 6 > printf("x = %s.\n", hpaste(x, maxHead = 4)) x = 1, 2, 3, 4, 5, 6. > ## x = 1, 2, 3, 4, 5 and 6. > > # Showing the tail > printf("x = %s.\n", hpaste(x, maxHead = 1, maxTail = 2)) x = 1, ..., 5, 6. > ## x = 1, ..., 5, 6. > > # Turning off abbreviation > printf("y = %s.\n", hpaste(y, maxHead = Inf)) y = 10, 9, 8, 7, 6, 5, 4, 3, 2, 1. > ## y = 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 > > ## ...or simply > printf("y = %s.\n", paste(y, collapse = ", ")) y = 10, 9, 8, 7, 6, 5, 4, 3, 2, 1. > ## y = 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 > > # Change last separator > printf("x = %s.\n", hpaste(x, lastCollapse = " and ")) x = 1, 2, 3, 4, 5 and 6. > ## x = 1, 2, 3, 4, 5 and 6. > > # No collapse > stopifnot(all(hpaste(x, collapse = NULL) == x)) > > # Empty input > stopifnot(identical(hpaste(character(0)), character(0))) > > message("*** hpaste() ... DONE") *** hpaste() ... DONE > > > > message("*** mdebug ...") *** mdebug ... > > for (debug in c(FALSE, TRUE)) { + mdebug("debug=", debug, debug = debug) + mdebugf("debug=%f\n", debug, debug = debug) + mprint(list(debug = debug), debug = debug) + mstr(list(debug = debug), debug = debug) + } [08:12:44.453] debug=TRUE [08:12:44.454] debug=1.000000 [08:12:44.454] $debug [08:12:44.454] [1] TRUE [08:12:44.454] [08:12:44.454] List of 1 [08:12:44.454] $ debug: logi TRUE > > message("*** mdebug ... DONE") *** mdebug ... DONE > > > message("- stealth_sample.int() ...") - stealth_sample.int() ... > > if (exists(".Random.seed", envir = globalenv(), inherits = FALSE)) { + rm(".Random.seed", envir = globalenv(), inherits = FALSE) + } > > stopifnot(!exists(".Random.seed", envir = globalenv(), inherits = FALSE)) > x <- stealth_sample.int(10L) > str(x) int [1:10] 2 9 3 5 4 10 8 7 6 1 > stopifnot(!exists(".Random.seed", envir = globalenv(), inherits = FALSE)) > > set.seed(42L) > seed0 <- globalenv()[[".Random.seed"]] > stopifnot(!is.null(seed0)) > x0 <- stealth_sample.int(10L) > str(x0) int [1:10] 1 5 10 8 2 4 6 9 7 3 > seed <- globalenv()[[".Random.seed"]] > stopifnot(!is.null(seed), identical(seed, seed0)) > > x <- stealth_sample.int(10L) > str(x) int [1:10] 1 5 10 8 2 4 6 9 7 3 > stopifnot(identical(x, x0)) > seed <- globalenv()[[".Random.seed"]] > stopifnot(!is.null(seed), identical(seed, seed0)) > > message("- stealth_sample.int() ... DONE") - stealth_sample.int() ... DONE > > > message("*** stop_if_not() ...") *** stop_if_not() ... > > stop_if_not() NULL > res <- tryCatch(stop_if_not(FALSE), error = identity) > stopifnot(inherits(res, "error")) > > res <- tryCatch(stop_if_not(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE), error = identity) > stopifnot(inherits(res, "error")) > > message("*** stop_if_not() ... DONE") *** stop_if_not() ... DONE > > > message("*** utils ... DONE") *** utils ... DONE > > source("incl/end.R") R Under development (unstable) (2023-12-19 r85710 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows Server 2022 x64 (build 20348) Matrix products: default locale: [1] LC_COLLATE=C LC_CTYPE=German_Germany.utf8 [3] LC_MONETARY=C LC_NUMERIC=C [5] LC_TIME=C time zone: Europe/Berlin tzcode source: internal attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] doFuture_1.0.1 future_1.33.0 foreach_1.5.2 loaded via a namespace (and not attached): [1] compiler_4.4.0 parallelly_1.36.0 tools_4.4.0 [4] parallel_4.4.0 future.apply_1.11.0 listenv_0.9.0 [7] codetools_0.2-19 iterators_1.0.14 digest_0.6.33 [10] globals_0.16.2 > > proc.time() user system elapsed 0.51 0.10 0.60