Get startedGet started for free

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.

This exercise is part of the course

Scalable Data Processing in R

View Course

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

Hands-on interactive exercise

Have a go at this exercise by completing this sample 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
Edit and Run Code