[R] A question on Programming

Oliver oliver at first.in-berlin.de
Fri Nov 11 13:26:37 CET 2011


Christofer Bogaso <bogaso.christofer <at> gmail.com> writes:
[...]
> Here my question is, is there any speed reduction if I put them within a
> function (I think there may be some speed reduction at least within
> for-loop, because that loop needs to call that function many times),
> relative to if I used that group of codes as-it-is in many places?
[...]


You did not asked for it, you may know it, or may not know it:
if you use apply functions and other vector oriented functions,
this can bring you a huge speedup, compared to a for-loop.


Ciao,
   Oliver



More information about the R-help mailing list