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" themortdata by yearMap(): To "apply" the functionfemale_residence_prop()to each of the subsets returned fromsplit()Reduce(): To combine the results obtained fromMap()
In this exercise, you will "split" the mort data by year.
Diese Übung ist Teil des Kurses
Scalable Data Processing in R
Anleitung zur Übung
- Split the row numbers of the mortgage data by the
"year"column and assign the result tospl. - Call
str()onsplto see the results.
Interaktive Übung
Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.
# Split the row numbers of the mortage data by year
spl <- ___(1:nrow(___), mort[, ___])
# Call str on spl
___