The Borrower Income Ratio
The borrower income ratio is the ratio of the borrower’s (or borrowers’) annual income to the median family income of the area for the reporting year. This is the ratio used to determine whether borrower’s income qualifies for an income-based housing goal.
In the data set mort
, missing values are recoded as 9. In this exercise, we replaced the 9's in the "borrower_income_ratio"
column with NA
, so you can create a table of the borrower income ratios.
Cet exercice fait partie du cours
Scalable Data Processing in R
Instructions
- Load the
biganalytics
anddplyr
packages. - Call
summary()
onmort
to check that"borrower_income_ratio"
now hasNA
s. - Using
bigtable()
, create a table of borrower income ratios for each year. - Use
dplyr
'smutate()
to add a new columnBIR
.
Exercice interactif pratique
Essayez cet exercice en complétant cet exemple de code.
# Load biganalytics and dplyr packages
___
___
# Call summary on mort
___
bir_df_wide <- ___(mort, c(___, "year")) %>%
# Turn it into a data.frame
as.data.frame() %>%
# Create a new column called BIR with the corresponding table categories
___(BIR = c(">=0,<=50%", ">50, <=80%", ">80%"))
bir_df_wide