r_make | R Documentation |
The r_*()
functions, such as r_make()
,
enhance reproducibility by launching a drake
function in
a separate R process.
r_make(source = NULL, r_fn = NULL, r_args = list())
r_drake_build(
target,
character_only = FALSE,
...,
source = NULL,
r_fn = NULL,
r_args = list()
)
r_outdated(..., source = NULL, r_fn = NULL, r_args = list())
r_recoverable(..., source = NULL, r_fn = NULL, r_args = list())
r_missed(..., source = NULL, r_fn = NULL, r_args = list())
r_deps_target(
target,
character_only = FALSE,
...,
source = NULL,
r_fn = NULL,
r_args = list()
)
r_drake_graph_info(..., source = NULL, r_fn = NULL, r_args = list())
r_vis_drake_graph(..., source = NULL, r_fn = NULL, r_args = list())
r_sankey_drake_graph(..., source = NULL, r_fn = NULL, r_args = list())
r_drake_ggraph(..., source = NULL, r_fn = NULL, r_args = list())
r_text_drake_graph(..., source = NULL, r_fn = NULL, r_args = list())
r_predict_runtime(..., source = NULL, r_fn = NULL, r_args = list())
r_predict_workers(..., source = NULL, r_fn = NULL, r_args = list())
source |
Path to an R script file that
loads packages, functions, etc. and returns a
|
r_fn |
A |
r_args |
List of arguments to |
target |
Name of the target. |
character_only |
Logical, whether |
... |
Arguments to the inner function. For example, if you want to call
|
drake
searches your environment
to detect dependencies, so functions like make()
, outdated()
, etc.
are designed to run in fresh clean R sessions. Wrappers r_make()
,
r_outdated()
, etc. run reproducibly even if your current R session
is old and stale.
r_outdated()
runs the four steps below.
r_make()
etc. are similar.
Launch a new callr::r()
session.
In that fresh session, run the R script from the source
argument.
This script loads packages, functions, global options, etc.
and calls drake_config()
at the very end. drake_config()
is the preprocessing step of make()
, and it accepts
all the same arguments as make()
(e.g. plan
and targets
).
In that same session, run outdated()
with the config
argument from step 2.
Return the result back to main process (e.g. your interactive R session).
make(recover = TRUE, recoverable = TRUE)
powers automated data recovery.
The default of recover
is FALSE
because
targets recovered from the distant past may have been generated
with earlier versions of R and earlier package environments
that no longer exist.
How it works: if recover
is TRUE
,
drake
tries to salvage old target values from the cache
instead of running commands from the plan.
A target is recoverable if
There is an old value somewhere in the cache that shares the command, dependencies, etc. of the target about to be built.
The old value was generated with make(recoverable = TRUE)
.
If both conditions are met, drake
will
Assign the most recently-generated admissible data to the target, and
skip the target's command.
make()
## Not run:
isolate_example("quarantine side effects", {
if (requireNamespace("knitr", quietly = TRUE)) {
writeLines(
c(
"library(drake)",
"load_mtcars_example()",
"drake_config(my_plan, targets = c(\"small\", \"large\"))"
),
"_drake.R" # default value of the `source` argument
)
cat(readLines("_drake.R"), sep = "\n")
r_outdated()
r_make()
r_outdated()
}
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.