if (FALSE) {
# Copy example scripts:
file.copy(
from = system.file("examples", c("success.R", "warning.R", "error.R"),
package = "whirl"
),
to = tempdir()
)
# Run a single script and create log:
run(file.path(tempdir(), "success.R"))
# Run several scripts in parallel on up to 2 workers:
run(
input = file.path(tempdir(), c("success.R", "warning.R", "error.R")),
n_workers = 2
)
# Run several scripts in two steps by providing them as list elements:
run(
list(
file.path(tempdir(), c("success.R", "warning.R")),
file.path(tempdir(), "error.R")
)
)
# Re-directing the logs to a sub-folder by utilizing the log_dir argument in
# run(). This will require that the sub-folder exists.
# Specifying the path using a manually defined character
run(file.path(tempdir(), "success.R"), log_dir = tempdir())
# Specifying the path with a generic function that can handle the scripts
# individually.
run(
input = file.path(tempdir(), "success.R"),
log_dir = function(x) {paste0(dirname(x), "/logs")}
)
}
Run the code above in your browser using DataLab