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

Exercise

Futures for advertisement targets

An online streaming platform has hired you as a Data Analyst. Every quarter, they launch a marketing campaign for the highest-spending segment of their customers. To correctly target this campaign to the right users, they want to generate distributions for the average monthly revenue from users across different groups. They have already segmented their customers based on factors such as geography, estimated income, etc.

In your workspace, you have a list, subs_list. Each element of this list is a vector of monthly subscription payments for one segment of customers. The function, boot_dist(), is also available. This function bootstraps a distribution for the average revenue. That must be applied to each element of subs_list. The future package has been loaded for you.

Instructions

100 XP
  • Plan a multisession with four workers.
  • Using lapply(), create a future for every mapping of boot_dist() onto an element of subs_list.
  • Query the value of each future in future_list.
  • Revert to a sequential plan.