Modify a list
list_modify()
and list_merge()
recursively combine two lists, matching
elements either by name or position. If a sub-element is present in
both lists list_modify()
takes the value from y
, and list_merge()
concatenates the values together.
update_list()
handles formulas and quosures that can refer to
values existing within the input list. Note that this function
might be deprecated in the future in favour of a dplyr::mutate()
method for lists.
list_modify(.x, ...) list_merge(.x, ...)
.x |
List to modify. |
... |
New values of a list. Use These values should be either all named or all unnamed. When
inputs are all named, they are matched to These dots support tidy dots features. In
particular, if your functions are stored in a list, you can
splice that in with |
x <- list(x = 1:10, y = 4, z = list(a = 1, b = 2)) str(x) # Update values str(list_modify(x, a = 1)) # Replace values str(list_modify(x, z = 5)) str(list_modify(x, z = list(a = 1:5))) # Remove values str(list_modify(x, z = zap())) # Combine values str(list_merge(x, x = 11, z = list(a = 2:5, c = 3))) # All these functions support tidy dots features. Use !!! to splice # a list of arguments: l <- list(new = 1, y = zap(), z = 5) str(list_modify(x, !!!l))
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.