modifyList2 {Require} | R Documentation |
modifyList
for multiple lists
Description
This calls utils::modifyList
iteratively using
base::Reduce
, so it can handle >2 lists.
The subsequent list elements that share a name will override
previous list elements with that same name.
It also will handle the case where any list is a NULL
. Note:
default keep.null = TRUE
, which is different than modifyList
Usage
modifyList2(..., keep.null = FALSE)
modifyList3(..., keep.null = TRUE)
Arguments
... |
One or more named lists. |
keep.null |
If |
Details
More or less a convenience around
Reduce(modifyList, list(...))
, with some checks, and the addition of
keep.null = TRUE
by default.
Note
modifyList3
retains the original behaviour of modifyList2
(prior to
Oct 2022); however, it cannot retain NULL
values in lists.
Examples
modifyList2(list(a = 1), list(a = 2, b = 2))
modifyList2(list(a = 1), NULL, list(a = 2, b = 2))
modifyList2(
list(a = 1), list(x = NULL), list(a = 2, b = 2),
list(a = 3, c = list(1:10))
)
[Package Require version 1.0.0 Index]