Open shouldsee opened 7 years ago
Avoid slicing a data.frame within a for-loop, it will be VERY slow!
dat = data.frame(1:1000,1:1000) mat = as.matrix(dat) A = function(){ (for i in 1:1000){d=dat[i,]} } B = function(){ (for i in 1:1000){d = mat[i,}} sys.time(A()) sys.time(B())
Avoid slicing a data.frame within a for-loop, it will be VERY slow!