Re: [R] skip for loop

2010-04-05 Thread Etienne Bellemare Racine
you can use break : for(i in 1:5) { #e.g. a <- sample(1:10, 1) # important part : if(a==3) break } a or while : a <- 0 while(a != 3){ # an operation that change a : a <- sample(1:10, 1) } Etienne Le 2010-04-05 10:46, Ravi S. Shankar a écrit : > Hi R, > > > > I am running

Re: [R] skip for loop

2010-04-05 Thread Tal Galili
wouldn't using inside the loop: if ("a"==3){ # do one thing } else { # do another thing } Do the trick ? Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biosta

[R] skip for loop

2010-04-05 Thread Ravi S. Shankar
Hi R, I am running a for loop in which I am doing a certain calculation. As an outcome of calculation I get an out put say "a". Now in my for loop "I" needs to be initiated to "a". Based the below example if the output "a"=3 then the second iteration needs to be skipped. Is there a way to