[R] lapply sequence

Duncan Murdoch murdoch.duncan at gmail.com
Wed Apr 20 15:08:54 CEST 2011


On 20/04/2011 7:26 AM, Dean Marks wrote:
> Good day,
>
> My question is: Does the lapply function guarantee a particular sequence in
> which elements are mapped? And, are we guaranteed that lapply will always be
> sequential (i.e. never map elements in parallel) ?

No.

> The reason I ask is if I use lapply with the mapping function set to
> something that has side-effects that need to be executed in a particular
> sequence.

Use a for loop.
> If this is not possible, is there an alternate method other than using a for
> loop?

while or repeat.

Duncan Murdoch



More information about the R-help mailing list