Message-ID: <7709C2219BF83E408C90D5C6F9343C134EEBB8@rnumsem04.nala.roche.com>
Date: 2009-03-04T20:53:04Z
From: Lo, Ken
Subject: flow control
Hi all,
I need a little help with flow control in R. What I'd like to do is to
advance a for loop by changing its counter. However, what seems obvious
to me does not yield the proper results. An example of my problem is
for (i in seq(1, some_number, some_increment)){
<some stuff>
if (some_condition == T) i <- i + 2; #want to advance the loop
by 2
}
Whenever the counter goes to the next step, the next item in the
original sequence seq(1, some_number, some_increment) replaces the
counter value. Is there a way for me to do this?
Best,
Ken