Re: [R] r: LOOPING

From: Vehbi Sinan Tunalioglu <>
Date: Fri 08 Jul 2005 - 17:30:49 EST

Uwe Ligges wrote:
> Clark Allan wrote:

>>i know that one should try and limit the amount of looping in R
>>programs. i have supplied some code below. i am interested in seeing how
>>the code cold be rewritten if we dont use the loops.

> It is not always a good thing to remove loops (without having looked at
> each details of the code below).
> "Compromise" is the keyword.

If you have big routines for each iteration and especially you have back references in the data structures you are manipulating, it becomes really _hard to translate_ loop statements to filter-map-accumulator routines provided by R (i.e. *apply functions). I really cannot find my way in some situations. What I did so far is to write those routines in C. Dirty hack :(

Maybe one should write a tutorial: "Howto avoid loops in R" by giving possible scenarios.

--vst mailing list PLEASE do read the posting guide! Received on Fri Jul 08 17:42:14 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:22 EST