updateList {NetLogoR} | R Documentation |
Update elements of a named list with elements of a second named list
Description
Merge two named list based on their named entries. Where any element matches in both lists, the value from the second list is used in the updated list. Subelements are not examined and are simply replaced. If one list is empty, then it returns the other one, unchanged.
Usage
updateList(x, y)
## S4 method for signature 'list,list'
updateList(x, y)
## S4 method for signature ''NULL',list'
updateList(x, y)
## S4 method for signature 'list,'NULL''
updateList(x, y)
## S4 method for signature ''NULL','NULL''
updateList(x, y)
Arguments
x , y |
a named list |
Value
A named list, with elements sorted by name.
The values of matching elements in list y
replace the values in list x
.
Author(s)
Alex Chubaty
Examples
L1 <- list(a = "hst", b = NA_character_, c = 43)
L2 <- list(a = "gst", c = 42, d = list(letters))
updateList(L1, L2)
updateList(L1, NULL)
updateList(NULL, L2)
updateList(NULL, NULL) # should return empty list
[Package NetLogoR version 1.0.5 Index]