list.merge: Merge a number of named lists in sequential order

Description Usage Arguments Details Examples

View source: R/list.merge.R

Description

The function merges a number of lists in sequential order by modifyList, that is, the later list always modifies the former list and form a merged list, and the resulted list is again being merged with the next list. The process is repeated until all lists in ... or list are exausted.

Usage

1

Arguments

...

named lists

Details

List merging is usually useful in the merging of program settings or configuraion with multiple versions across time, or multiple administrative levels. For example, a program settings may have an initial version in which most keys are defined and specified. In later versions, partial modifications are recorded. In this case, list merging can be useful to merge all versions of settings in release order of these versions. The result is an fully updated settings with all later modifications applied.

Examples

1
2
3
4
l1 <- list(a=1,b=list(x=1,y=1))
l2 <- list(a=2,b=list(z=2))
l3 <- list(a=2,b=list(x=3))
list.merge(l1,l2,l3)

Example output

$a
[1] 2

$b
$b$x
[1] 3

$b$y
[1] 1

$b$z
[1] 2

rlist documentation built on Sept. 5, 2021, 5:30 p.m.