mergeLists: Merge two lists with precedence

Description Usage Arguments Value Examples

View source: R/mergeList.r

Description

This function merges two lists to create a single, combined list. If there is a conflict (e.g., two elements have the same name), items in the second list gain preference. Adapted from Stack Overflow (http://stackoverflow.com/questions/13811501/r-merge-lists-with-overwrite-and-recursion).

Usage

1
mergeLists(list1, list2)

Arguments

list1

List object.

list2

List object.

Value

List object.

Examples

1
2
3
4
5
6
list1 <- list(a=1:3, b='Hello world', c=LETTERS[1:3])
list2 <- list(x=4, b='Goodbye world', z=letters[1:2])
mergeLists(list1, list2)
mergeLists(list2, list1)
list3 <- list(m=list(n=4:7, o=pi), a=1:5)
mergeLists(list1, list3)

adamlilith/omnibus documentation built on Nov. 21, 2018, 11:01 a.m.