1. Learn
  2. /
  3. Courses
  4. /
  5. Parallel Programming in R

Connected

Exercise

Row-binding future_map results

You work for a higher studies consultancy which recommends US universities to applicants abroad. You have sourced a university ranking dataset which contains a column score for research, citations, etc, for different universities.

The team statistician has written a function, calc_quants(), that is available to you. This function calculates a range for the scores of a given university. It takes two arguments, 1) a data frame with the column score, and 2) the quantile values of interest q_values. The quantiles of interest are available to you as the variable my_q_values.

my_q_values <- c(0.025, 0.975)

You are asked to apply this function to the data for each university in parallel.

furrr and tidyverse have been loaded for you.

Instructions

100 XP
  • Create a configuration that specifies my_q_values as a global variable required by all workers.
  • Split the data frame uni_data by university_name.
  • Apply calc_quants() to each university's scores using the correct future_map() variant to bind results by rows.
  • Specify the values for the q_values and configuration for .options.