Learn R Programming

targets (version 0.7.0)

tar_config_get: Get configuration settings from _targets.yaml.

Description

Read the custom settings in the optional _targets.yaml configuration file at the current project.

Usage

tar_config_get(name, config = "_targets.yaml")

Arguments

name

Character of length 1, name of the specific configuration setting to retrieve. If name is "config", then instead of retrieving a specific setting, then tar_config_get() will return the path to the YAML file where those settings are stored for the current R session (default: _targets.yaml).

config

Character of length 1, path to the YAML file with all the configuration settings (default: _targets.yaml).

Value

The value of the configuration setting from the YAML configuration file (default: _targets.yaml) or the default value if the setting is not available. The data type of the return value depends on your choice of name.

Details

Each project can have an optional YAML configuration file (default: _targets.yaml) with settings specific to a given project. You can write it by hand or modify it with tar_config_set(). The currently supported configuration settings are documented as the arguments of tar_config_set().

See Also

Other configuration: tar_config_set(), tar_envvars(), tar_option_get(), tar_option_reset(), tar_option_set()

Examples

Run this code
# NOT RUN {
if (identical(Sys.getenv("TAR_EXAMPLES"), "true")) {
tar_dir({ # tar_dir() runs code from a temporary directory.
tar_script(list(tar_target(x, 1 + 1)))
tar_config_get("store") # "_targets"
store_path <- tempfile()
tar_config_set(store = store_path)
tar_config_get("store") # Shows a temp file.
tar_make() # Writes to the custom data store identified in _targets.yaml.
tar_read(x) # tar_read() knows about _targets.yaml too.
file.exists("_targets") # FALSE
file.exists(store_path) # TRUE
})
}
# }

Run the code above in your browser using DataLab