mergeLists {omnibus} | R Documentation |
This function merges two or more lists to create a single, combined list. If two elements in different lists have the same name, items in the later list gain preference (e.g., if there are three lists, then values in the third list gain precedence over items with the same name in the second, and the second has precedence over items in the first).
mergeLists(...)
... |
Two or more lists. |
A list.
list1 <- list(a=1:3, b='Hello world!', c=LETTERS[1:3])
list2 <- list(x=4, b='Goodbye world!', z=letters[1:2])
list3 <- list(x=44, b='What up, world?', z=c('_A_', '_Z_'), w = TRUE)
mergeLists(list1, list2)
mergeLists(list2, list1)
mergeLists(list1, list2, list3)
mergeLists(list3, list2, list1)