CommencerCommencer gratuitement

Combine

You now know the female proportion borrowing for urban and rural areas for all years. However, the result resides in a list. Converting this list to a matrix or data frame may sometimes be convenient in case you want to calculate any summary statistics or visualize the results. In this exercise, you will combine the results into a matrix.

Cet exercice fait partie du cours

Scalable Data Processing in R

Afficher le cours

Instructions

all_years from the previous exercise is available in your workspace.

  • Call Reduce() on all_years to combine the results from the previous exercise. The function to apply here is rbind (short for row bind).
  • Use the dimnames() function to add row and column names to this matrix, prop_female.
    • The rownames are the names() of the list all_years.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Collect the results as rows in a matrix
prop_female <- ___(___, ___)

# Rename the row and column names
___(prop_female) <- list(___, c("prop_female_urban", "prop_femal_rural"))

# View the matrix
prop_female
Modifier et exécuter le code