resolve: Resolve String(s) Using a Dictionary

View source: R/dictionary.R

resolveR Documentation

Resolve String(s) Using a Dictionary

Description

Resolve String(s) Using a Dictionary

Usage

resolve(x, ...)

Arguments

x

vector of character to be resolved or a list of which all elements will be resolved using itself as a "dictionary". A dictionary is a list of key = value pairs defining string replacements.

...

Unnamed arguments are treated as (further) dictionaries. These are merged first to one dictionary before merging further (named) key = value pairs.

Examples

file <- system.file("extdata", "dictionary.txt", package = "kwb.utils")

dictionary <- readDictionary(file)

# Resolve the dictionary
resolve(dictionary)

# Resolve the dictionary by setting an undefined placeholder
resolve(dictionary, extension = "pdf")
  
# Resolve a string
resolve("dir.project", dictionary)

# Set a placeholder "on-the-fly"
resolve("file.out", dictionary, extension = "pdf")

# Override a placeholder "on-the-fly"
resolve("dir.project", dictionary, project = "new_project")

# Resolve a vector of strings
resolve(c("dir.root", "dir.project"), dictionary, project = "vector")


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