[R] Incrementing a counter in lapply

Gabor Grothendieck ggrothendieck at gmail.com
Tue Mar 14 17:00:35 CET 2006


On 3/14/06, Thomas Lumley <tlumley at u.washington.edu> wrote:
> On Tue, 14 Mar 2006, John McHenry wrote:
>
> > Thanks, Gabor & Thomas.
> >
> > Apologies, but I used an example that obfuscated the question that I
> > wanted to ask.
> >
> > I really wanted to know how to have extra arguments in functions that
> > would allow, per the example code, for something like a counter to be
> > incremented. Thomas's suggestion of using mapply (reproduced below with
> > corrections) is probably closest.
>
> It is probably worth pointing out here that the R documentation does not
> specify the order in which lapply() does the computation.
>

I suspect that a huge amount of application code takes advantage
of this order.




More information about the R-help mailing list