Re: [R] apply() just loops ?

From: Greg Snow <Greg.Snow_at_imail.org>
Date: Wed, 12 Nov 2008 11:23:27 -0700

Markus,

You may also want to read the Help Desk article in the 8/1 R-News newsletter. It discusses the similarities and differences of *apply and loops and also shows the slowdowns from some common loops (that *apply tend to avoid).

Hope this helps,

--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow_at_imail.org
801.408.8111



> -----Original Message-----
> From: r-help-bounces_at_r-project.org [mailto:r-help-bounces_at_r-
> project.org] On Behalf Of Mark Lyman
> Sent: Wednesday, November 12, 2008 10:44 AM
> To: r-help_at_stat.math.ethz.ch
> Subject: Re: [R] apply() just loops ?
>
> 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.
>
> http://finzi.psych.upenn.edu/R/Rhelp02a/archive/76330.html
>
> Mark Lyman
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.
______________________________________________ R-help_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Received on Wed 12 Nov 2008 - 18:25:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 12 Nov 2008 - 18:30:24 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive