Description Usage Arguments Details Value Author(s) Examples
Joining or updating lists of parameters.
1 2 3 4 5 6 7 | updateList(input, update, ignoreNULLs = TRUE)
updateNULLs(input, update, ignoreNULLs = TRUE)
updateMissing(input, update, ignoreNULLs = TRUE)
updateJoin(input, update, ignoreNULLs = FALSE)
|
input |
|
update |
|
ignoreNULLs |
logical, if |
updateList replaces values of any elements in input that
also are contained in update with new values from update.
updateNULLs works like updatelist, however only NULL
values are replaced, other values remain untouched. The value of ignoreNULLs
does not really matter here.
updateMissing complements the list input by elements in
update, but does not change existing values in input, even if
they are NULLs.
updateJoin returns a merged list of input and update,
with priority of non-NULL values contained in update.
The result of updatejoin(A, B) is almost the same as
updateMissing(B, A), up to not forcing to preserve NULL
values in B. By default, ignoreNULLs is set to FALSE here,
thus the result also contains NULL elements from update, if no
element with same name was present in input.
A simplist with updated values, see the Details
Ute Hahn, ute@imf.au.dk
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | A <- simplist(a = NULL, b = "b from A", c = "c from A", d = "d from A")
B <- simplist(a = "a from B", b = "b from B", c = NULL,
e = "e from B", f = NULL)
str(updateList(A, B))
# sequence does not matter:
str(updateList(A[c(3, 2, 1)], B))
# forcing new NULL values
str(updateList(A, B, ignoreNULLs = FALSE))
str(updateNULLs(A, B))
str(updateMissing(A, B))
str(updateMissing(A, B, ignoreNULLs = FALSE))
str(updateJoin(A, B))
str(updateJoin(A, B, ignoreNULLs = TRUE))
# this can be used to remove NULL values from a list:
str(updateJoin(A, NULL, ignoreNULLs = TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.