การประมวลผลข้อมูลขนาดใหญ่ใน R
Simon Urbanek
Member of R-Core, Lead Inventive Scientist, AT&T Labs Research
# Create a random vector
x <- rnorm(100)
# Find the mean
mean(x)
-0.01996644
# Take the sum of chunks of
# the vector
sl <- Map(function(v) {
c(sum(v), length(v))},
list(x[1:25], x[26:100]))
# Add the sums and lengths
slr <- Reduce(`+`, sl)
# Find the mean
slr[1]/slr[2]
-0.01996644
การดำเนินการที่ต้องใช้ข้อมูลทั้งหมดพร้อมกัน ไม่สามารถคำนวณด้วยแนวทาง Split-Apply-Combine ได้
ตัวอย่าง: Median
รูทีน regression หลายแบบสามารถเขียนในรูปแบบ split-apply-combine ได้
การประมวลผลข้อมูลขนาดใหญ่ใน R