開始使用免費開始

比較 read.delim() 與 read.delim.raw()

當你在硬碟上以連續區塊的方式處理資料時,iotools 可以在將 raw 物件轉成 data.framematrix 的同時,預先讀取下一個資料區塊。這些最佳化讓 iotools 能夠快速處理非常大的檔案。

本練習屬於課程

R 的可擴展資料處理

檢視課程

練習說明

  • 使用 read.delim() 讀取檔案並計時,共執行 5 次。
  • 使用 read.delim.raw() 讀取檔案並計時,共執行 5 次。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Load the iotools and microbenchmark packages
___
___

# Time the reading of files
___(
    # Time the reading of a file using read.delim five times
    ___("mortgage-sample.csv", header = FALSE, sep = ","),
    # Time the reading of a file using read.delim.raw five times
    ___("mortgage-sample.csv", header = FALSE, sep = ","),
    times = ___
)
編輯並執行程式碼