future_invoke_map: Invoke functions via futures

Description Usage Arguments Examples

View source: R/future_invoke_map.R

Description

These functions work exactly the same as purrr::invoke_map() functions, but allow you to invoke in parallel.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
future_invoke_map(.f, .x = list(NULL), ..., .env = NULL,
  .progress = FALSE, .options = future_options())

future_invoke_map_chr(.f, .x = list(NULL), ..., .env = NULL,
  .progress = FALSE, .options = future_options())

future_invoke_map_dbl(.f, .x = list(NULL), ..., .env = NULL,
  .progress = FALSE, .options = future_options())

future_invoke_map_int(.f, .x = list(NULL), ..., .env = NULL,
  .progress = FALSE, .options = future_options())

future_invoke_map_lgl(.f, .x = list(NULL), ..., .env = NULL,
  .progress = FALSE, .options = future_options())

future_invoke_map_dfr(.f, .x = list(NULL), ..., .env = NULL,
  .progress = FALSE, .options = future_options())

future_invoke_map_dfc(.f, .x = list(NULL), ..., .env = NULL,
  .progress = FALSE, .options = future_options())

Arguments

.f

A list of functions.

.x

A list of argument-lists the same length as .f (or length 1). The default argument, list(NULL), will be recycled to the same length as .f, and will call each function with no arguments (apart from any supplied in ....)

...

Additional arguments passed to each function.

.env

Environment in which do.call() should evaluate a constructed expression. This only matters if you pass as .f the name of a function rather than its value, or as .x symbols of objects rather than their values.

.progress

A logical, for whether or not to print a progress bar for multiprocess, multisession, and multicore plans.

.options

The future specific options to use with the workers. This must be the result from a call to future_options().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
plan(multiprocess)


df <- dplyr::tibble(
  f = c("runif", "rpois", "rnorm"),
  params = list(
    list(n = 10),
    list(n = 5, lambda = 10),
    list(n = 10, mean = -3, sd = 10)
  )
)

future_invoke_map(df$f, df$params)

furrr documentation built on May 2, 2019, 1:04 p.m.