比较 read.delim() 与 read.delim.raw()
当从硬盘顺序处理一系列相邻的数据分块时,iotools 可以将原始对象转换为 data.frame 或 matrix,同时获取下一个数据分块。这些优化使 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 = ___
)