LoslegenKostenlos loslegen

Who is securing federally guaranteed loans?

Borrower's income is not in the data set. However, annual income divided by the median income of people in the local area is. This is called the Borrower Income Ratio. Let's look at the proportion of federally guaranteed loans for each borrower income category.

Diese Übung ist Teil des Kurses

Scalable Data Processing in R

Kurs anzeigen

Anleitung zur Übung

  • Use the bigtable() function to make a table of the borrower_income_ratio by federal_guarantee.
  • For each row in ir_by_fg, divide by the sum of the row.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Tabulate borrower_income_ratio and federal_guarantee
ir_by_fg <- ___(mort, ___)

# Label the columns and rows of the table
dimnames(ir_by_fg) <- list(income_cat, guarantee_cat)

# For each row in ir_by_fg, divide by the sum of the row
for (i in seq_len(nrow(___))) {
  ir_by_fg[___, ] = ir_by_fg[___, ] / sum(ir_by_fg[___, ])
}

# Print
ir_by_fg
Code bearbeiten und ausführen