fuse: Merges (fuses) lists recursively

Description Usage Arguments Details Value Examples

View source: R/fuse.R

Description

Merges lists so that alike-named elements at the same level of list hierarchy receive the values that come last in the list of arguments.

Usage

1

Arguments

...

lists to be fused

Details

Side effect of this implementation is that elements get sorted on every level.

Value

merged list (or vector if arguments are vectors)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
fuse(1, 2) # Returns 2
# Example 1
# x = 1 gets replaced by x = list(z = NULL)
# y = 0 gets replaced by y = 2
fuse(list(y = 0), list(x = 1, y = 2), list(x = list(z = NULL)))
# ... and the result equals list(x = list(z = NULL), y = 2)
#
# Example 2
fuse(0, list(NULL), NA, NULL) # yields NA
# ... because the last NULL is ignored 
# and arguments 0, list(NULL) and NA are fused as unnamed 
# and on the same level of list hierarchy

avidclam/avidstart documentation built on May 17, 2019, 10:01 a.m.