Replace NULL items in a defined depth of a list.
Usage
replace_list_nulls(l, replacement = NA, depth = 2L)
Arguments
- l
A list.
- replacement
A replacement for NULL items.
- depth
An integer scalar: depth of l to search for and replace NULL items.
Value
The list l with NULL items replaced by replacement in the defined depth.
Examples
replace_list_nulls(list(a = list(b = 1, c = NULL)))
#> $a
#> $a$b
#> [1] 1
#>
#> $a$c
#> [1] NA
#>
#>