การประมวลผลข้อมูลขนาดใหญ่ใน R
Simon Urbanek
Member of R-Core, Lead Inventive Scientist, AT&T Labs Research
ทำซ้ำขั้นตอน 1 ถึง 3 จนกว่าจะประมวลผลข้อมูลครบ
ใน iotools การโหลดข้อมูลจากดิสก์และการแปลงข้อมูลดิบเป็น R objects ถูกแยกออกจากกัน เพื่อให้มีความยืดหยุ่นและประสิทธิภาพสูงขึ้น
readAsRaw() อ่านข้อมูลทั้งหมดลงใน raw vectorread.chunk() อ่านข้อมูลเป็น chunk ลงใน raw vectormstrsplit() แปลงข้อมูลดิบเป็น matrixdstrsplit() แปลงข้อมูลดิบเป็น data frameread.delim.raw() = readAsRaw() + dstrsplit()
# Open a file connection
fc <- file("data-file.csv", "rb")
# Read the first line if the data has a header
readLines(fc, n = 1)
....
# Code to import and parse the data
....
# Close the file connection
close(fc)
การประมวลผลข้อมูลขนาดใหญ่ใน R