Run the stages in a stageRunner object.
run(from = NULL, to = NULL, verbose = FALSE, remember_flag = getOption("stagerunner.remember", TRUE), mode = self$.mode, normalized = FALSE, .depth = 1, ...)
from | an indexing parameter. Many forms are accepted, but the
easiest is the name of the stage. For example, if we have
|
---|---|
to | an indexing parameter. If |
verbose | logical. Whether or not to display pretty colored text informing about stage progress. nested list of logicals. |
remember_flag | logical. An internal argument used by |
mode | character. If |
normalized | logical. A convenience recursion performance helper. If
|
.depth | integer. Internal parameter for keeping track of nested execution depth. |
... | Any additional arguments to delegate to the |
TRUE or FALSE according as running the stages specified by the
from
and to
keys succeeded or failed. If
remember = TRUE
, this will instead be a list of the environment
before and after executing the aforementioned stages. (This allows
comparing what changes were made to the context
during the
execution of the stageRunner.)
env <- new.env() some_fn <- function(e) e$x <- 1 other_fn <- function(e) e$y <- 1 another_fn <- function(e) e$z <- 1 sr <- stagerunner(env, list(stage_one = stagerunner(env, list(substage_one = some_fn, substage_two = other_fn)), stage_two = another_fn)) # Here, the following all execute only substage_two: sr$run(list(list(FALSE, TRUE), FALSE)) sr$run(list(list(1, 2))) sr$run('stage_one/substage_two') sr$run('one/two') stopifnot(is.null(env$z), is.null(env$x), identical(env$y, 1)) # This will execute all but "stage_one" (i.e., only "stage_two") sr$run(-1) stopifnot(identical(env$z, 1))