Replace all the empty values in a list

replace_null(x, replacement = NA)

Arguments

x

list to use

replacement

Replacement value for missing values

Examples

list(a = NULL, b = 1, c = list(foo = NULL, bar = NULL)) %>% replace_null()
#> $a #> [1] NA #> #> $b #> [1] 1 #> #> $c #> $c$foo #> [1] NA #> #> $c$bar #> [1] NA #> #>