tarchives version of targets::tar_load(). Reads one or more targets from
an archived pipeline's store and assigns them into an environment.
Usage
tar_load_archive(
names,
package,
pipeline,
branches = NULL,
meta = NULL,
strict = TRUE,
silent = FALSE,
envir = parent.frame(),
store = targets::tar_config_get("store")
)Arguments
- names
Names of the targets to load.
tar_load()uses non-standard evaluation in thenamesargument (example:tar_load(names = everything())), whereastar_load_raw()uses standard evaluation fornames(example:tar_load_raw(names = quote(everything()))).The object supplied to
namesshould be atidyselectexpression likeany_of()orstarts_with()fromtidyselectitself, ortar_described_as()to select target names based on their descriptions.- package
A scalar character of the package name.
- pipeline
A scalar character of the pipeline name.
- branches
Integer of indices of the branches to load for any targets that are patterns.
- meta
Data frame of target metadata from
tar_meta().- strict
Logical of length 1, whether to error out if one of the selected targets is in the metadata but cannot be loaded. Set to
FALSEto just load the targets in the metadata that can be loaded and skip the others.- silent
Logical of length 1. Only relevant when
strictisFALSE. IfsilentisFALSEandstrictisFALSE, then a message will be printed if a target is in the metadata but cannot be loaded. However, load failures will not stop other targets from being loaded.- envir
R environment in which to load target return values.
- store
Character of length 1, directory path to the data store of the pipeline.
Examples
# \donttest{
withr::with_envvar(
c(R_USER_CACHE_DIR = tempfile()),
{
tar_make_archive(package = "tarchives", pipeline = "example-model")
tar_load_archive(model, package = "tarchives", pipeline = "example-model")
model
}
)
#>
#> Call:
#> lm(formula = Sepal.Width ~ Sepal.Length, data = data)
#>
#> Coefficients:
#> (Intercept) Sepal.Length
#> 1.131 0.278
#>
# }