R/read.R
Loads the object(s) into the
current workspace (or environment envir
if given). Defaults
to loading the entire cache if you do not supply anything
to arguments ...
or list
.
loadd(..., list = character(0), imported_only = FALSE, path = getwd(), search = TRUE, cache = drake::get_cache(path = path, search = search, verbose = verbose), namespace = NULL, envir = parent.frame(), jobs = 1, verbose = drake::default_verbose(), deps = FALSE, lazy = "eager", graph = NULL, replace = TRUE)
... | targets to load from the cache: as names (symbols),
character strings, or |
---|---|
list | character vector naming targets to be loaded from the
cache. Similar to the |
imported_only | logical, whether only imported objects should be loaded. |
path | Root directory of the drake project,
or if |
search | logical. If |
cache | drake cache. See |
namespace | character scalar, name of an optional storr namespace to load from. |
envir | environment to load objects into. Defaults to the calling environment (current workspace). |
jobs | number of parallel jobs for loading objects. On
non-Windows systems, the loading process for multiple objects
can be lightly parallelized via |
verbose | logical or numeric, control printing to the console.
Use
|
deps | logical, whether to load any cached
dependencies of the targets
instead of the targets themselves.
This is useful if you know your
target failed and you want to debug the command in an interactive
session with the dependencies in your workspace.
One caveat: to find the dependencies,
|
lazy | either a string or a logical. Choices:
|
graph | optional igraph object, representation
of the workflow network for getting dependencies
if |
replace | logical. If |
NULL
loadd()
excludes foreign imports:
R objects not originally defined in envir
when make()
last imported them.
To get these objects, use readd()
.
readd()
, cached()
, built()
,
imported()
, drake_plan()
, make()
,
# NOT RUN { test_with_dir("Quarantine side effects.", { load_basic_example() # Get the code with drake_example("basic"). make(my_plan) # Run the projects, build the targets. loadd(small) # Load target 'small' into your workspace. small # For many targets, you can parallelize loadd() # using the 'jobs' argument. loadd(list = c("small", "large"), jobs = 2) ls() # How about tidyselect? loadd(starts_with("summ")) ls() # Load the dependencies of the target, coef_regression2_small loadd(coef_regression2_small, deps = TRUE) ls() # Load all the imported objects/functions. # Note: loadd() excludes foreign imports # (R objects not originally defined in `envir` # when `make()` last imported them). loadd(imported_only = TRUE) ls() # Load all the targets listed in the workflow plan # of the previous `make()`. # Be sure your computer has enough memory. loadd() ls() # With files, you just get the fingerprint. loadd(list = file_store("report.md")) ls() # Should include "\"report.md\"". get(file_store("report.md")) }) # }