merge_list_to_default | R Documentation |
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.
merge_list_to_default(pl_base, pl_default)
pl_base |
list of base entries |
pl_default |
list with default entries |
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.
l_result list with merged entries of pl_base and pl_default
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.