Skip to main content
v2026.11,986 entries · CC-BY 4.0

How to Use the furrr R Package for Parallel Computing

A guide to the furrr R package for researchers: parallelize purrr map functions across local CPU cores and compute clusters using the futureverse framework.

Written and maintained by CASRAI Editorial Board

Published

On this page

The furrr package is an open-source R library that provides drop-in parallel replacements for the functional programming family in purrr by routing iterations through future evaluation backends. Developed by Davis Vaughan, Henrik Bengtsson, Matt Dancho, and Posit Software, furrr converts serial functional workflows such as map(), map2(), and pmap() into asynchronous executions across local CPU cores or distributed cluster nodes with identical syntax. Researchers analyzing large-scale datasets, running Monte Carlo simulations, or fitting batched statistical models use furrr to accelerate compute times while preserving purrr’s predictable return types.

What furrr is used for in research

Modern quantitative research frequently requires repetitive computations across large experimental datasets. Researchers routinely run Monte Carlo simulations across parameter grids, fit batched regression models across demographic subgroups, or generate non-parametric bootstrap confidence intervals. Performing these tasks using serial loops executes one calculation at a time on a single CPU core, leaving modern multi-core workstations underutilized.

In the R ecosystem, the tidyverse package purrr introduced a consistent and expressive vocabulary for functional programming, allowing analysts to replace imperative looping constructs with readable purrr map() functions. However, purrr operates exclusively in serial mode. While base R provides the base R apply family functions and the parallel library offers functions like mclapply and parLapply, transitioning from tidyverse pipelines to base parallel functions often requires rewriting analytical scripts, managing low-level process forks, and handling unpredictable data structures.

The furrr package solves this architectural challenge by bridging purrr’s functional syntax with the robust parallel evaluation framework of Henrik Bengtsson’s future ecosystem. By adopting a strict separation between syntax and hardware backends, furrr allows researchers to write clean, idiomatic tidyverse code that works identically in serial execution and across parallel hardware. When combined with the dplyr data manipulation framework, furrr allows researchers to execute nested list-column operations and group-wise modeling across separate CPU processes without modifying analytical logic.

Key research applications where furrr provides substantial acceleration include:

  • Resampling and Non-Parametric Bootstrapping: Generating resampled datasets and estimating empirical confidence intervals for non-linear models and estimators.
  • Monte Carlo Simulation Experiments: Evaluating statistical test behavior, power curves, and estimator bias across independent synthetic data variations.
  • Stratified Batch Modeling: Fitting separate generalized linear models or survival curves across distinct cohorts or experimental conditions.
  • High-Throughput Omics and Bioinformatics: Preprocessing, normalizing, and calculating quality-control metrics across large batches of sample assays.
  • Cross-Validation and Hyperparameter Optimization: Training predictive models across k-fold cross-validation splits simultaneously across available CPU cores.

Crucially for scientific integrity, furrr integrates native support for safe, independent pseudo-random number streams via the L’Ecuyer-CMRG algorithm. Parallel calculations that rely on random sampling, such as permutations or simulations, can easily produce duplicated or correlated pseudo-random numbers if workers share the same random seed. By enforcing explicit seed management, furrr guarantees computational reproducibility across disparate operating systems and multi-core architectures.

How to install or access furrr

The furrr package is distributed on the Comprehensive R Archive Network (CRAN) as free and open-source software under the MIT license. To run furrr, your system must have R version 4.1.0 or higher installed, along with future version 1.70.0 or higher.

To install the stable release of furrr and its foundational dependencies from CRAN, execute the standard package installation command in your R console:

install.packages("furrr")

To install companion packages for backend orchestration and core detection, install future and parallelly:

install.packages(c("future", "parallelly", "purrr"))

To access pre-release developments, the development version can be installed from GitHub:

if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
remotes::install_github("futureverse/furrr")

Attach both packages at the beginning of your script:

library(furrr)
library(future)

Inspect available compute cores using parallelly, which respects container constraints and cgroup limits:

parallelly::availableCores()

furrr functions operate across standard R interfaces, including command-line Rscript sessions, RStudio Desktop, RStudio Server, and modern integrated development environments like Positron.

How to parallelize purrr workflows step by step

Converting a serial purrr workflow into a high-performance parallel execution requires six systematic steps. This walkthrough demonstrates how to establish an execution topology, map computations across workers, ensure reproducible random number generation, and release system resources upon completion.

  1. Establish the parallel evaluation plan. The central tenet of the Futureverse architecture is that the user decides how futures are resolved independently from the analytical code. This is configured using future::plan(). For local multi-core workstations and interactive sessions (including RStudio and Positron), the multisession strategy is the gold standard. It launches background Rscript sessions that communicate over local socket connections, ensuring complete cross-platform stability across Linux, macOS, and Windows:
    plan(multisession, workers = 4)

    On Unix-based operating systems (Linux and macOS) executing via batch terminal scripts, researchers may also use plan(multicore, workers = 4) to leverage POSIX process forking. However, forking is unsupported on Windows and causes severe instabilities inside graphical IDEs. For initial script development and debugging, plan(sequential) allows the entire pipeline to run synchronously in the primary session.

  2. Structure the input dataset and mapping function. Input data can be structured as an atomic vector, a list of data frames, or a nested tibble. Each iteration should represent an independent, self-contained unit of work. For example, consider an empirical researcher who needs to compute bootstrap regression estimates across multiple experimental trial strata:
    library(dplyr)
    set.seed(42)
    trial_data %
      mutate(response = 12.5 + 0.45 * dose - 0.20 * biomarker + rnorm(2000, 0, 5))
    
    cohort_list <- split(trial_data, trial_data$trial_id)
  3. Select the appropriate future mapping verb. furrr mirrors the purrr API by prefixing standard mapping functions with future_. The table below outlines how common purrr functions map to their furrr counterparts alongside their return types and behavior:
    purrr Function furrr Equivalent Return Type Iteration Pattern
    map() future_map() List Single vector or list input (.x)
    map_dbl() future_map_dbl() Double vector Strict numeric double output validation
    map_chr() future_map_chr() Character vector Strict text string output validation
    map_int() future_map_int() Integer vector Strict integer output validation
    map_lgl() future_map_lgl() Logical vector Strict boolean TRUE/FALSE validation
    map_dfr() future_map_dfr() Data frame (tibble) Row-binds iteration results into one table
    map_dfc() future_map_dfc() Data frame (tibble) Column-binds iteration results into one table
    map2() future_map2() List Parallel iteration over two inputs (.x and .y)
    pmap() future_pmap() List Parallel iteration over list of multiple arguments (.l)
    modify() future_modify() Same type as .x In-place modification preserving container structure
    walk() future_walk() Invisibly returns .x Side-effects execution (file exports, plot saving)
    imap() future_imap() List Indexed iteration supplying element and name/index

    To ensure type stability across complex pipelines, prefer typed variants such as future_map_dbl() or future_map_dfr() over generic list mapping whenever the output structure is known in advance.

  4. Configure execution options with furrr_options(). Parallel workers operate in isolated, clean R environments. To control package imports, variable exports, and random number generation, pass a configured furrr_options() object to the .options argument:
    parallel_opts <- furrr_options(
      seed = TRUE,
      packages = c("dplyr"),
      globals = TRUE,
      scheduling = 1
    )

    Setting seed = TRUE activates L’Ecuyer-CMRG random number streams across all workers. Setting scheduling = 1 ensures that work is divided evenly across workers (one chunk per worker), minimizing inter-process communication overhead.

  5. Execute the parallel mapping call. Define your model estimation function and pass the input list to future_map_dfr() to run the models in parallel and automatically row-bind the fitted coefficients:
    fit_cohort_model <- function(df) {
      mod <- lm(response ~ dose + biomarker, data = df)
      coefs |t|)"]
      )
    }
    
    model_results <- future_map_dfr(
      cohort_list,
      fit_cohort_model,
      .options = parallel_opts
    )

    Each worker evaluates its assigned cohort independently, captures the resulting tibble, and returns the result to the primary R session, where furrr binds them into a consolidated data frame.

  6. Close workers and reset the evaluation plan. Background worker sessions persist in the operating system process table until explicitly closed or until the primary R session terminates. To free system RAM and release network sockets cleanly, reset the plan to sequential execution upon job completion:
    plan(sequential)

    Resetting the plan is critical in shared computing environments, HPC clusters, and automated batch scripts to prevent orphaned processes and memory leaks.

How to read the output

Interpreting results from furrr mapping functions relies on understanding how purrr structures and validates return values. Because furrr enforces identical contracts to purrr, outputs preserve strict type consistency across all iterations.

When using future_map(), the output is always a standard R list where element i corresponds to the evaluation of .f(.x[[i]]). If any iteration returns a complex object, such as a fitted glm model, an htest object, or a nested list, it remains fully intact:

length(model_results_list)       # Matches length of input .x
class(model_results_list[[1]])   # Matches return class of .f

When using typed vector mapping functions such as future_map_dbl() or future_map_chr(), furrr verifies that each worker returns exactly one element of the declared atomic type. If an iteration returns a vector of length greater than one, or returns a character string when a double was declared, furrr immediately halts execution and throws an informative type-mismatch error. This strict contract protects downstream analytical code from silent type coercion bugs.

For tabular outputs, future_map_dfr() row-binds individual iteration tibbles using vctrs::vec_rbind() semantics. Column names are matched automatically, and missing columns are filled with NA. In modern tidyverse pipelines, analysts may also capture list outputs and bind them explicitly using purrr::list_rbind() for enhanced control over index column generation:

raw_list <- future_map(cohort_list, fit_cohort_model, .options = parallel_opts)
consolidated_df <- purrr::list_rbind(raw_list, names_to = "cohort_name")

Handling errors gracefully is essential in large-scale research workflows where a single malformed data record or convergence failure could crash hours of computation. Wrapping the mapping function in purrr::safely() or purrr::possibly() enables fault-tolerant execution:

safe_fit <- purrr::safely(fit_cohort_model, otherwise = NULL)
safe_results <- future_map(cohort_list, safe_fit, .options = parallel_opts)

successful_models % purrr::compact()
errors_encountered % purrr::compact()

By default, standard output messages and warnings generated on background workers are captured and relayed back to the main R console once the futures resolve. Researchers can inspect relayed conditions to detect statistical warnings, such as rank deficiency or convergence tolerance limits, without losing track of which worker produced the message.

The data table below outlines the core parallel backends, execution mechanisms, and compatibility constraints across R computing environments, illustrating how worker configurations differ across systems.

Troubleshooting furrr

Parallel computing introduces nuances in process isolation, variable scoping, and memory consumption. Below are the most common technical issues researchers encounter when executing furrr workflows, along with verified diagnostic strategies from the official documentation.

Non-standard evaluation and argument serialization

In serial purrr, mapping functions delay the evaluation of arguments passed through ..., allowing data-masking verbs in packages like dplyr to resolve column names lazily. In contrast, furrr must serialize all arguments and ship them across socket connections to worker processes before execution begins. Consequently, arguments passed through ... are evaluated exactly once in the main session. If an argument references a column that exists only inside the worker’s iteration environment, the main session fails with an object not found error. To avoid this, explicitly encapsulate column references using tidy-evaluation injection ({{ col }}) or pass self-contained formulas and functions.

Function environment capture and memory bloat

In R, functions and formula closures (~ .x) automatically capture their enclosing lexical environment. If an anonymous mapping function is defined inside a parent function that contains large datasets, model objects, or lookup tables, furrr serializes the entire enclosing environment and transmits it to every background worker process. In a 16-worker job, copying a 500 MB environment to every worker immediately consumes 8 GB of RAM, triggering system swapping or out-of-memory kernel kills. To prevent environment bloat:

  • Define mapping functions as standalone, top-level functions rather than closures nested within heavy functions.
  • Explicitly prune unused objects from the environment using rm() before invoking future_map().
  • Use the carrier::crate() function to construct isolated closures that bundle only explicitly declared variables.

Random number generator warnings and duplicate streams

If your mapping function calls stochastic functions such as rnorm(), sample(), or runif() without configuring the seed option, furrr issues a prominent warning: UNRELIABLE VALUE: Future ... uses non-standard random numbers. In parallel computing, naive random number generation allows separate worker processes to draw identical pseudo-random sequences, invalidating simulation results. To resolve this, always pass furrr_options(seed = TRUE) or supply an explicit integer seed. furrr automatically initializes L’Ecuyer-CMRG multi-stream random number generation, ensuring each worker receives an independent, non-overlapping stream.

Unexported global variables and missing packages

Because multisession workers run in clean background R processes, they do not automatically inherit packages loaded in the main session via library(), nor do they inherit variables created dynamically unless identified by static code analysis. If a worker fails with could not find function or object not found, explicitly declare dependencies in furrr_options():

opts <- furrr_options(
  packages = c("survival", "MASS"),
  globals = c("baseline_hazard", "custom_summary")
)

Using explicit package declarations guarantees that worker sessions attach the appropriate namespaces before evaluating tasks.

Chunking overhead on large numbers of small tasks

Inter-process communication (IPC) over socket connections introduces fixed serialization and transfer overhead. If an analysis maps 500,000 trivial tasks that each take 10 microseconds to calculate, the time spent serializing inputs and transferring results between the main session and background workers will far exceed the execution time of the calculation itself, causing the parallel script to run substantially slower than serial purrr. To resolve this, group tasks into larger chunks using the chunk_size or scheduling parameters in furrr_options():

opts <- furrr_options(chunk_size = 1000)

Chunking aggregates input elements into contiguous batches, minimizing the number of discrete IPC transactions.

Multicore stability issues in graphical IDEs

Setting plan(multicore) relies on POSIX fork() system calls. While process forking avoids IPC initialization overhead on Linux and macOS, forking a multi-threaded process inside graphical desktop environments such as RStudio or Positron is fundamentally unsafe and leads to instant session crashes or deadlocks. The parallelly and future packages actively detect these environments and issue warnings or disallow forking. In all interactive graphical sessions, always use plan(multisession) instead.

Free alternatives to furrr

R offers multiple open-source packages for parallel processing and distributed computing. The optimal choice depends on whether your workflow prioritizes tidyverse syntax compatibility, pipeline dependency management, or bare-metal execution performance.

The base R parallel package, included in every standard R distribution, provides foundational multiprocessing primitives. Its mclapply function offers lightweight process forking for Unix systems, while parLapply provides socket-based clustering. However, base parallel functions lack strict output type checking, require distinct syntax for Windows versus POSIX systems, and do not integrate cleanly into tidyverse pipelines.

The foreach and doParallel package combination represents a mature, widely adopted looping framework in statistical research. Using the binary operator %dopar%, foreach executes loop bodies across diverse compute backends, including doMPI for high-performance supercomputing clusters and doSNOW for socket clusters. While foreach excels in nested looping and arbitrary cluster backend support, its loop-based syntax differs markedly from the functional mapping philosophy of purrr.

For complex analytical projects involving interdependent data cleaning, model fitting, and manuscript generation, the targets reproducible pipeline toolkit provides macro-level parallelization. Rather than parallelizing iterations inside a single script, targets constructs a formal directed acyclic graph of the entire research project and skips up-to-date targets while computing independent steps simultaneously across background workers.

Within the Futureverse ecosystem itself, future.apply provides direct parallel drop-in replacements for base R apply functions (such as future_lapply, future_sapply, and future_apply). Researchers who prefer base R syntax over purrr can utilize future.apply while benefiting from the exact same plan() topologies and L’Ecuyer-CMRG random number streams.

Tool / Package Iteration Paradigm Execution Backend Tidyverse Parity Type Safety Primary Research Fit
furrr Functional mapping (future_map) future (multisession, multicore, cluster) Full purrr drop-in replacement High (strict typed variants) Interactive data science, tidyverse simulation pipelines, bootstrapping
base parallel Apply-style list mapping (mclapply, parLapply) POSIX fork or socket cluster Low (distinct base R conventions) Low (returns generic list or array) Scripts with zero external dependency requirements on headless servers
foreach / doParallel Loop-based evaluation (%dopar%) doParallel, doMPI, doSNOW backends Moderate (custom combination operators) Moderate (controlled via .combine) Legacy packages, MPI supercomputing clusters, nested grid evaluations
future.apply Base apply mapping (future_lapply) future (multisession, multicore, cluster) Low (mirrors base R apply functions) Moderate (base R simplify rules) Base R codebases seeking cross-platform future backend flexibility
targets DAG-based pipeline orchestration (tar_make) crew, future, clustermq workers High (integrates with tidyverse scripts) High (target data format validation) Multi-step research pipelines, reproducible automated data workflows

Sources

Data: R Parallel Computing Backends and Worker Execution Profiles

Comparative benchmark and architectural specifications of parallel execution backends available for R computational workflows, detailing process models, operating system support, IDE safety, IPC overhead, and random number stream protocols across future and base parallel implementations compiled from official CRAN and Futureverse documentation.

Period covered: 2026. Coverage: Global.

R Parallel Computing Backends and Worker Execution Profiles
Backend StrategyFramework LayerOS SupportIDE SafetyProcess ModelIPC OverheadRNG Protocol
sequentialfutureCross-platform (Linux, macOS, Windows)SafeSingle primary R processNoneNative R default / L'Ecuyer-CMRG
multisessionfuture / parallellyCross-platform (Linux, macOS, Windows)SafeBackground Rscript socket sessionsModerateL'Ecuyer-CMRG multi-stream
multicorefuture / parallelPOSIX only (Linux, macOS; not Windows)Unsafe (crashes graphical IDEs)Forked POSIX child processesLow (copy-on-write memory)L'Ecuyer-CMRG multi-stream
clusterfuture / parallellyCross-platform (local or remote networks)SafeTCP socket or SSH worker sessionsHighL'Ecuyer-CMRG multi-stream
mclapply (base)parallelPOSIX only (Linux, macOS; not Windows)Unsafe (instability in GUI sessions)Forked POSIX child processesLow (copy-on-write memory)L'Ecuyer-CMRG via RNGkind()
parLapply (base)parallelCross-platform (Linux, macOS, Windows)SafeSNOW-style socket cluster workersModerate to HighL'Ecuyer-CMRG via clusterSetRNGStream()

Sources

Compiled by CASRAI from the sources above. Free to reuse under CC BY 4.0 with attribution.

Follow CASRAI

Research-administration guidance, standards updates and independent tool reviews.

Ask CASRAI · full access

Ask about How to Use the furrr R Package for Parallel Computing

Full access: large monthly usage, up to 10 source passages behind each answer, and MCP and API access for Claude Code, Codex and other CLIs. Cancel any time.

An AI assistant for research: funder rules, compliance, methods and publishing. It links the sources behind its answers and labels answers that come from a web search.

Answers draw on CASRAI's guides and dictionary plus the federal and funder documents we index: Federal Register, Grants.gov, Regulations.gov and UKRI.

Works on this site and inside Claude, Cursor and the AI tools you already use.

Everything CASRAI publishes — this page, the dictionary, the guides and the news — stays open to read, with no account and no card.

Referenced across the research world

University of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logoUniversity of Cambridge logoColumbia University logoCrossref logoUniversity of Edinburgh logoHarvard University logoUniversity of Oxford logoPrinceton University logoStanford School of Medicine logoUniversity College London logoORCID logo
  • University of Cambridge logo
  • Columbia University logo
  • Crossref logo
  • University of Edinburgh logo
  • Harvard University logo
  • University of Oxford logo
  • Princeton University logo
  • Stanford School of Medicine logo
  • University College London logo
  • ORCID logo

View CASRAI adoption →