Learn R Programming

drake (version 5.2.1)

readd: Read and return a drake target/import from the cache.

Description

Does not delete the item from the cache.

Usage

readd(target, character_only = FALSE, path = getwd(), search = TRUE,
  cache = drake::get_cache(path = path, search = search, verbose = verbose),
  namespace = NULL, verbose = drake::default_verbose(),
  show_source = FALSE)

Arguments

target

If character_only is TRUE, then target is a character string naming the object to read. Otherwise, target is an unquoted symbol with the name of the object.

character_only

logical, whether name should be treated as a character or a symbol (just like character.only in library()).

path

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

search

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

cache

drake cache. See new_cache(). If supplied, path and search are ignored.

namespace

optional character string, name of the storr namespace to read from.

verbose

logical or numeric, control printing to the console. Use pkgconfig to set the default value of verbose for your R session: for example, pkgconfig::set_config("drake::verbose" = 2).

0 or FALSE:

print nothing.

1 or TRUE:

print only targets to build.

2:

in addition, print checks and cache info.

3:

in addition, print any potentially missing items.

4:

in addition, print imports. Full verbosity.

show_source

logical, option to show the command that produced the target or indicate that the object was imported (using show_source()).

Value

The cached value of the target.

See Also

loadd(), cached(), built(), link{imported}, drake_plan(), make()

Examples

Run this code
# NOT RUN {
test_with_dir("Quarantine side effects.", {
load_mtcars_example() # Get the code with drake_example("mtcars").
make(my_plan) # Run the project, build the targets.
readd(reg1) # Return imported object 'reg1' from the cache.
readd(small) # Return targets 'small' from the cache.
readd("large", character_only = TRUE) # Return 'large' from the cache.
# For external files, only the fingerprint/hash is stored.
readd(file_store("report.md"), character_only = TRUE)
})
# }

Run the code above in your browser using DataLab