[R] “For” calculation is so slow
Zhou Fang
zhou.zfang at gmail.com
Tue May 22 16:21:41 CEST 2012
I'm not sure what you are trying to prove with that example - the loopless
versions are massively faster, no?
I don't disagree that loops are sometimes unavoidable, and I suppose
sometimes loops can be faster when the non-loop version e.g. breaks your
memory budget, or performs tons of needless computations. But I think
avoiding for loops whenever you can is a good rule of thumb in R coding.
--
View this message in context: http://r.789695.n4.nabble.com/For-calculation-is-so-slow-tp4630830p4630897.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list