[R] Incrementing a counter in lapply

Thomas Lumley tlumley at u.washington.edu
Tue Mar 14 18:04:10 CET 2006


On Tue, 14 Mar 2006, Gabor Grothendieck wrote:

> On 3/14/06, Thomas Lumley <tlumley at u.washington.edu> wrote:
>> 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.
>

I don't.  The order of evaluation is usually not readily observable. You 
either have to use <<- to modify an external variable or you have to 
produce printed or graphical output where the order matters.

There's probably some examples, but there are some examples of people 
using solve(t(X) %*% W %*% X) %*% W %*% Y to compute regression 
coefficients, too.


 	-thomas




More information about the R-help mailing list