[R] apply() just loops ?

Mark Lyman mark.lyman at atk.com
Wed Nov 12 18:44:13 CET 2008

Markus Loecher <mao.loecher <at> gmail.com> writes:

> Dear R users,
> I have been diligently using the apply() family in order to avoid explicit
> for loops and speed up computation.
> However, when I finally inspected the source code for apply, it appears that
> the core computation is a simple loop as well.
> What am I missing ? Why the often found advice to use apply() instead of
> loops and the actually observed empirical  speedups on many tasks ?
> Thanks in advance for demystifying,
> Markus

Professor Ripley gave the following response to a similar question, that I 
believe will answer your question.


Mark Lyman

More information about the R-help mailing list