resolveAll: Resolve all Placeholders in a Dictionary

View source: R/dictionary.R

resolveAllR Documentation

Resolve all Placeholders in a Dictionary

Description

Resolve all Placeholders in a Dictionary

Usage

resolveAll(dictionary, ...)

Arguments

dictionary

list with named elements where the element name represents the key and the element value represents the value assigned to the key.

...

additional assignments of the form <key> = <value> that are temporarily added to the dictionary before doing the resolving

Examples

# Define a dictionary in the form of a list
dictionary <- list(
  basedir = "C:/myNicefolder",
  projectdir = "<basedir>/projects/<project_name>",
  inputdir = "<projectdir>/input",
  outputdir = "<projectdir>/output"
)

# Resolve all entries in the dictionary, with different values for the
# placeholder "<project_name> which is undefined in the original dictionary
dictionary.1 <- resolveAll(dictionary, project_name = "project_1")
dictionary.2 <- resolveAll(dictionary, project_name = "project_2")

# Define entries of the dictionary to resolve
keys <- c("inputdir", "outputdir")

# Resolve the entries using the two different dictionaries
resolve(keys, dictionary.1)
resolve(keys, dictionary.2)


KWB-R/kwb.utils documentation built on April 1, 2024, 7:12 a.m.