7 ms·
It'a actually a little complicated but if you're interested in the details check out this stack overflow thread [1]. High level summary is that lapply() and fun
by chuckcode 12y ago
It'a actually a little complicated but if you're interested in the details check out this stack overflow thread [1]. High level summary is that lapply() and functions built on top of it do some work in native C and so are generally faster but not all of the *apply() functions are faster.
[1] http://stackoverflow.com/questions/2275896/is-rs-apply-family-more-than-syntactic-sugar http://stackoverflow.com/questions/2275896/is-rs-apply-famil...
- mbq 12y agoThe problem here is not the for-loop itself but the time used by the R runtime on executing the mapped function multiplied by the number of iterations (this is BTW the main source of advantage for dynamic and GCed but JITed languages like JS or Julia).