ComeçarComece de graça

Split

To calculate the proportions for all years, you will use the function female_residence_prop() defined in the previous exercise along with three other functions:

  • split(): To "split" the mort data by year
  • Map(): To "apply" the function female_residence_prop() to each of the subsets returned from split()
  • Reduce(): To combine the results obtained from Map()

In this exercise, you will "split" the mort data by year.

Este exercício faz parte do curso

Scalable Data Processing in R

Ver curso

Instruções do exercício

  • Split the row numbers of the mortgage data by the "year" column and assign the result to spl.
  • Call str() on spl to see the results.

Exercício interativo prático

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

# Split the row numbers of the mortage data by year
spl <- ___(1:nrow(___), mort[, ___])

# Call str on spl
___
Editar e executar o código