Map over leaves of multiple nested lists
Arguments
- .l
A list of nested lists.
- .f
A function, formula, or function-like object coercible by
rlang::as_function(). Additional arguments supplied through...are passed on to.f.- ...
Additional arguments passed to
.f.- .progress
Whether to show a progress
Use TRUE to turn on a basic progress, use a string to give it a name, or use a list to customize the progress bar (see
?cli::cli_progress_barand https://cli.r-lib.org/articles/progress-advanced.html#cli_progress_bar for details).
See also
Other lstrrr-purrrlike:
list_flatten(),
list_imap(),
list_iwalk(),
list_map(),
list_map2(),
list_modify_if(),
list_pwalk(),
list_walk(),
list_walk2()
Examples
# \donttest{
x <- list(
a = 1,
b = list(
x = 1,
y = list(i = 1, j = 2)
)
)
list_pmap(list(x,x,x), function(x,y,z) (x + y) *z)
#> $a
#> [1] 2
#>
#> $b
#> $b$x
#> [1] 2
#>
#> $b$y
#> $b$y$i
#> [1] 2
#>
#> $b$y$j
#> [1] 8
#>
#>
#>
# $a
# [1] 2
#
# $b
# $b$x
# [1] 2
#
# $b$y
# $b$y$i
# [1] 2
#
# $b$y$j
# [1] 8
# }
