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

Foldable operations (II)

Now, you'll use the function on partitions of the data set. You should realize that by performing this operation in pieces and then aggregating, you don't need to have all of the data in a variable at once. This point isn't that important with small data sets, like the mortgage sample data, but it is for large data sets.

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

Scalable Data Processing in R

ดูคอร์ส

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

The foldable_range() function is available in your workspace.

  • Split the rows of mort by the "year" column.
  • Use foldable_range() to get the range of the "record_number" column chunked by year.

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

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

# Split the mortgage data by year
spl <- ___

# Use foldable_range() to get the range of the record numbers
foldable_range(___(function(s) ___(mort[s, "record_number"]), ___))
แก้ไขและรันโค้ด