Furrr type specification
You wish to do a masters in engineering and you want to apply to universities in USA. You'd like to go to a university that has a good academic reputation.
You have sourced a dataset of university scores, available to you as a data frame uni_data
. The data frame has a column total_score
containing engineering academic scores (out of 100) for each university in USA. You would like to create a column called criteria
that takes the string value "Pass"
for any university that has a total_score
above 80, or else "Fail"
. If a score is missing the value should be NA
.
You have criterion_function()
in your workspace. You plan to apply this function to total_score
using an appropriate future_map()
variant. The packages parallel
and furrr
have been loaded for you.
This exercise is part of the course
Parallel Programming in R
Exercise instructions
- Plan a multisession and use all available cores except two.
- Create a new column using the correct
future_map()
variant to mapcriterion_function()
to the columntotal_score
. - Revert to a sequential plan.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Plan a multisession to use all cores but two
n_cores <- ___
___(___, ___)
# Create new column using the correct future_map variant
uni_data %>%
mutate(criteria = ___(___, ___))
# Revert to a sequential plan
___