Skip to contents

Map over leaves of multiple nested lists

Usage

list_pmap(.l, .f, ..., .progress = FALSE)

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_bar and https://cli.r-lib.org/articles/progress-advanced.html#cli_progress_bar for details).

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

# }