เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Borrower Race and Ethnicity by Year (I)

As a second exercise in creating big tables, suppose you want to see the total count by year, rather than for all years at once. Then you would create a table for each ethnicity for each year.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Scalable Data Processing in R

ดูคอร์ส

คำแนะนำการฝึกหัด

The character vector race_cat is available in your workspace.

  • Use the bigtable() function to create a table of the borrower race ("borrower_race") by year ("year").
  • Use the as.data.frame() function to convert the table into a data.frame and assign it to rydf.
  • Create a new column (Race) holding the race/ethnicity information using the race_cat variable.

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Create a table of the borrower race by year
race_year_table <- ___(mort, c(___, ___))

# Convert rydf to a data frame
rydf <- ___(race_year_table)

# Create the new column Race
rydf$___ <- ___

# Let's see what it looks like
rydf
แก้ไขและรันโค้ด