merge_list_to_default: Merge List To Default

View source: R/draft_helper.R

merge_list_to_defaultR Documentation

Merge List To Default

Description

Given two lists (pl_base and pl_default), the lists should be merged into a result list (l_result) such that the result contains all entries of pl_base and for the entries whose names are in pl_default, but are not in pl_base, the entries of pl_default is included in l_result. This leads to a list (l_result) which has the same names as pl_default, but for those names which are also in pl_base, the values from pl_base overwrite the values of pl_default.

Usage

merge_list_to_default(pl_base, pl_default)

Arguments

pl_base

list of base entries

pl_default

list with default entries

Details

This merging procedure is used in replacement of placeholders in templates where only parts of the placeholders are replaced with specified values and the rest is replaced with assumed default values.

Value

l_result list with merged entries of pl_base and pl_default

Examples

## Not run: 
n <- 9
l2 <- lapply(1:n, function(x) x)
names(l2) <- LETTERS[1:9]
merge_list_to_default(pl_base = list(A = 10L, B = 20L), pl_default = l2)

## End(Not run)

fbzwsqualitasag/qrmdtmpl documentation built on April 14, 2022, 6:42 p.m.