list_edit | R Documentation |
Edit the elements of a list by name
list_edit(.l, ..., .add = TRUE)
.l |
List to edit |
... |
Named elements to add or delete |
.add |
Should named elements not existing in the original list be added? |
list_edit
is similar to purrr::list_modify in
purrr
, but unlike list_modify
, does not operate recursively
on a list. It only edits elements at the top level of hierarchy.
Elements can be removed by setting them equal to NULL
.
list_edit(list(x = 1, y = 2), x = 10, z = 20) list_edit(list(x = 1, y = 2), x = NULL, y = 5) list_edit(list(x = 1, y = 2), !!!list(x = NULL, z = 100)) list_edit(list(x = 1, y = 2), x = 10, z = 20, .add = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.