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.
Este ejercicio forma parte del curso
Parallel Programming in R
Instrucciones del ejercicio
- Plan a multisession of five workers.
- Make a configuration for
future_map_dfr()functions and specify a chunk size of35. - Supply this configuration to the correct argument of
future_map_dfr(). - Revert to a sequential plan.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# 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
___