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.
Este exercício faz parte do curso
Scalable Data Processing in R
Instruções do exercício
all_years
from the previous exercise is available in your workspace.
- Call
Reduce()
onall_years
to combine the results from the previous exercise. The function to apply here isrbind
(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 listall_years
.
- The rownames are the
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# 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