future_map_vec {crossmap} | R Documentation |
Parallelized mapping functions that automatically determine type
Description
These functions work exactly the same as map_vec()
, map2_vec()
,
pmap_vec()
, imap_vec()
and xmap_vec()
,
but allow you to map in parallel.
Usage
future_map_vec(
.x,
.f,
...,
.class = NULL,
.progress = FALSE,
.options = furrr::furrr_options()
)
future_map2_vec(
.x,
.y,
.f,
...,
.class = NULL,
.progress = FALSE,
.options = furrr::furrr_options()
)
future_pmap_vec(
.l,
.f,
...,
.class = NULL,
.progress = FALSE,
.options = furrr::furrr_options()
)
future_imap_vec(
.x,
.f,
...,
.class = NULL,
.progress = FALSE,
.options = furrr::furrr_options()
)
future_xmap_vec(
.l,
.f,
...,
.class = NULL,
.progress = FALSE,
.options = furrr::furrr_options()
)
Arguments
.x |
A list or atomic vector. |
.f |
A function, formula, or vector (not necessarily atomic). If a function, it is used as is. If a formula, e.g.
This syntax allows you to create very compact anonymous functions. If character vector, numeric vector, or list, it is
converted to an extractor function. Character vectors index by
name and numeric vectors index by position; use a list to index
by position and name at different levels. If a component is not
present, the value of |
... |
Additional arguments passed on to |
.class |
If |
.progress |
A single logical. Should a progress bar be displayed? Only works with multisession, multicore, and multiprocess futures. Note that if a multicore/multisession future falls back to sequential, then a progress bar will not be displayed. Warning: The |
.options |
The |
.y |
A vector the same length as |
.l |
A list of vectors, such as a data frame. The length of .l determines the number of arguments that .f will be called with. List names will be used if present. |
Value
Equivalent to map_vec()
, map2_vec()
, pmap_vec()
,
imap_vec()
and xmap_vec()
See Also
The original functions: furrr::future_map()
,
furrr::future_map2()
, furrr::future_pmap()
, furrr::future_imap()
and future_xmap()
Non-parallelized equivalents: map_vec()
, map2_vec()
,
pmap_vec()
, imap_vec()
and xmap_vec()
Examples
fruits <- c("apple", "banana", "carrot", "durian", "eggplant")
desserts <- c("bread", "cake", "cupcake", "streudel", "muffin")
x <- sample(5)
y <- sample(5)
z <- sample(5)
names(z) <- fruits
future_map_vec(x, ~ . ^ 2)
future_map_vec(fruits, paste0, "s")
future_map2_vec(x, y, ~ .x + .y)
future_map2_vec(fruits, desserts, paste)
future_pmap_vec(list(x, y, z), sum)
future_pmap_vec(list(x, fruits, desserts), paste)
future_imap_vec(x, ~ .x + .y)
future_imap_vec(x, ~ paste0(.y, ": ", .x))
future_imap_vec(z, paste)
future_xmap_vec(list(x, y), ~ .x * .y)
future_xmap_vec(list(fruits, desserts), paste)