1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128
|
source("incl/start.R")
message("*** utils ...")
message("*** 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, ..., 6.
printf("x = %s.\n", hpaste(x, maxHead = 2))
## x = 1, 2, ..., 6.
printf("x = %s.\n", hpaste(x, maxHead = 3)) # Default
## 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 and 6.
# Showing the tail
printf("x = %s.\n", hpaste(x, maxHead = 1, maxTail = 2))
## 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
## ...or simply
printf("y = %s.\n", paste(y, collapse = ", "))
## 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.
# No collapse
stopifnot(all(hpaste(x, collapse = NULL) == x))
# Empty input
stopifnot(identical(hpaste(character(0)), character(0)))
message("*** hpaste() ... DONE")
message("*** mdebug() ...")
mdebug("Hello #", 1)
mprint(1:3)
mprintf("Hello #%d", 1)
mstr(1:3)
options(progressr.debug = TRUE)
mdebug("Hello #", 2)
mprint(1:3)
mprintf("Hello #%d", 2)
mstr(1:3)
options(progressr.debug = FALSE)
mdebug("Hello #", 3)
mprint(1:3)
mprintf("Hello #%d", 3)
mstr(1:3)
message("*** mdebug() ... DONE")
message("*** stop_if_not() ...")
stop_if_not()
tryCatch(stop_if_not(c(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)), error = identity)
message("*** stop_if_not() ... done")
message("*** %||% ...")
print(NULL %||% TRUE)
print(TRUE %||% FALSE)
message("*** %||% ... done")
message("*** query_r_cmd_check() ...")
print(query_r_cmd_check())
cat("Command line arguments:\n")
args <- commandArgs()
print(args)
cat("Working directory:\n")
pwd <- getwd()
print(pwd)
message("*** query_r_cmd_check() ... done")
message("*** in_r_cmd_check() ...")
print(in_r_cmd_check())
message("*** in_r_cmd_check() ... done")
message("*** .onLoad() ...")
progressr:::.onLoad(pkgname = "progressr")
message("*** .onLoad() ... done")
message("*** known_progression_handlers() ...")
res <- known_progression_handlers()
str(res)
message("*** known_progression_handlers() ... done")
message("*** utils ... DONE")
source("incl/end.R")
|