Recursively apply a function to each element of a nested list
Source:R/utils-misc.R
recurse_nested.Rd
Recursively apply a function to each element of a nested list
Value
A list which is the same as the list provided but with the given function applied to each element.
Examples
nested <- list(
a = "1",
b = "12.5",
c = "NA",
d = "alphabet",
e = list(
first = "NA",
second = "notanumber",
third = "100",
fourth = "0.45",
fifth = list(
one = "teal",
two = "NA",
three = "999"
)
)
)
recurse_nested(nested, parse_string)
#> $a
#> [1] 1
#>
#> $b
#> [1] 12.5
#>
#> $c
#> [1] NA
#>
#> $d
#> [1] "alphabet"
#>
#> $e
#> $e$first
#> [1] NA
#>
#> $e$second
#> [1] "notanumber"
#>
#> $e$third
#> [1] 100
#>
#> $e$fourth
#> [1] 0.45
#>
#> $e$fifth
#> $e$fifth$one
#> [1] "teal"
#>
#> $e$fifth$two
#> [1] NA
#>
#> $e$fifth$three
#> [1] 999
#>
#>
#>