Get startedGet started for free

Chunking the bootstrap

You are investigating how universities collaborate with each other for research and development. You have a list of a 100 data frames, ls_edu, in your workspace. Each data frame contains collaboration scores for universities in a given country.

You have also have the function, rating_quants() that calculates quantiles for the collaboration score for one data frame.

You have five cores available to do this calculation. You tried to apply rating_quants() to ls_edu using future_map_dfr(), but the computer ran out of RAM and your R session crashed. You have decided to use a chunk size of 35 so that no more than three bootstraps are run at a time. The furrr package is loaded for you.

This exercise is part of the course

Parallel Programming in R

View Course

Exercise instructions

  • Plan a multisession of five workers.
  • Make a configuration for future_map_dfr() functions and specify a chunk size of 35.
  • Supply this configuration to the correct argument of future_map_dfr().
  • Revert to a sequential plan.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Plan a multisession of five workers
___

# Make a configuration specifying chunk size
config <- ___
future_map_dfr(ls_edu, rating_quants,
# Supply the configuration to the correct argument
               ___ = ___,
               .id = "country")

# Revert to sequential plan
___
Edit and Run Code