ComeçarComece de graça

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.

Este exercício faz parte do curso

Parallel Programming in R

Ver curso

Instruções do exercício

  • 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.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Plan a multisession
___(___, ___)

# Create futures for every bootstrap
future_list <- ___(___, function (x) ___(boot_dist(x)))

# Query value of futures
dist_list <- ___(___)
                      
# Revert to sequential plan
___(___)
Editar e executar o código