modifyList
Recursively Modify Elements of a List

Description

Recursively modifies elements of list, including the nested list. Elements are identified by their names.

Usage

modifyList(x, val, keep.null = FALSE)

Arguments

x a list object to be modified.
val a list object that has components to replace the elements in x.
keep.null a logical value. If FALSE (the default), NULL values in val cause the corresponding element of x to be removed. If TRUE, such elements are set to NULL.

Details

Recursively finds elements in a list. Elements are identified by their names.
Value
returns the modification of the list x with the modified elements that are identified by their names.
See Also
list.
Examples
orig.list <- list(a = 1, b = list(b1 = 2, b2 = TRUE), c = list("iii"))
modifyList(orig.list,
    list(a = 3, b = list(b3 = "new b3", b2 = FALSE), c = FALSE))
modifyList(orig.list,
    list(b = list(b1 = NULL), c = NULL))
modifyList(orig.list,
    list(b = list(b1 = NULL), c = NULL), keep.null = TRUE)
Package utils version 6.1.1-7
Package Index