
The Futureverse is a unifying framework for parallelization and distributed processing in R. This package, futureverse, is a utility wrapper package that makes it easy to install most common Futureverse packages in one go.
Start by configuring Futureverse to parallelize on the current computer:
future::plan(future::multisession)After this, all it takes is a minor tweak to make your existing
lapply(), map(), or foreach()
code to run in parallel, e.g.
library(futurize)
## Sequential and parallel version of base R apply
y <- lapply(X, slow_fcn)
y <- lapply(X, slow_fcn) |> futurize()
## Sequential and parallel version of purrr map
library(purrr)
y <- X |> map(slow_fcn)
y <- X |> map(slow_fcn) |> futurize()
## Sequential and parallel version of foreach
library(foreach)
y <- foreach(x = X) %do% slow_fcn(x)
y <- foreach(x = X) %do% slow_fcn(x) |> futurize()To get progress updates, add a |> progressify(),
e.g.
library(progressify)
handlers(global = TRUE)
y <- lapply(X, slow_fcn) |> progressify() |> futurize()
y <- X |> map(slow_fcn) |> progressify() |> futurize()
y <- foreach(x = X) %do% slow_fcn(x) |> progressify() |> futurize()Call:
install.packages("futureverse")to install the two main go-to packages:
together with support packages:
Call:
install.packages("futureverse", dependencies = TRUE)to install also additional parallel backends:
plan(multisession)plan(multisession)