Learn R Programming

purrr (version 0.1.0)

map_call: Map a list to a function call

Description

While lift_dl() wraps a function in do.call(), map_call() is directly equivalent to do.call() except that it takes a list as first argument instead of a function. This makes `map_call()` pipable.

Usage

map_call(.x, .f, ...)

Arguments

.x
A list or a vector. Vectors are coerced to a list.
.f
A function or the name of a function to call with the elements of .x as arguments.
...
Additional arguments passed on to .f.

See Also

lift_dl() and do.call()

Examples

Run this code
# We map a list of strings to paste(), with sep = "-" and the
# string "2001" as additional arguments
list("01", "01") %>%
  map(~ sub("^01", "10", .)) %>%
  map_call("paste", "2001", sep = "-")

Run the code above in your browser using DataLab