Learn R Programming

drake (version 5.0.0)

loadd: Load multiple targets or imports from the drake cache.

Description

Loads the object(s) into the current workspace (or envir if given). Defaults to loading the whole cache if arguments ... and list are not set (or all the imported objects if in addition imported_only is TRUE).

Usage

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 = 1, deps = FALSE, lazy = FALSE)

Arguments

...

targets to load from the cache, as names (unquoted) or character strings (quoted). Similar to ... in remove(...).

list

character vector naming targets to be loaded from the cache. Similar to the list argument of remove().

imported_only

logical, whether only imported objects should be loaded.

path

Root directory of the drake project, or if search is TRUE, either the project root or a subdirectory of the project.

search

logical. If TRUE, search parent directories to find the nearest drake cache. Otherwise, look in the current working directory only.

cache

optional drake cache. See codenew_cache(). If cache is supplied, the path and search arguments are ignored.

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 parallel::mclapply(). just set jobs to be an integer greater than 1. On Windows, jobs is automatically demoted to 1.

verbose

logical, whether to print console messages

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, loadd() uses information that was stored in a drake_config() list and cached during the last make(). That means you need to have already called make() if you set deps to TRUE.

lazy

logical, whether to lazy load with delayedAssign() rather than the more eager assign().

Value

NULL

See Also

cached, built, imported, drake_plan, make,

Examples

Run this code
# 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)
# Load the dependencies of the target, coef_regression2_small
loadd(coef_regression2_small, deps = TRUE)
# Load all the imported objects/functions.
loadd(imported_only = TRUE)
# Load everything, including built targets.
# Be sure your computer has enough memory.
loadd()
})
# }

Run the code above in your browser using DataLab