Skip to content
Prev 132820 / 398502 Next

Conditionally incrementing a loop counter

Mike Jones wrote:
You're not being entirely clear. If you don't increment the loop 
counter, you generally get stuck in an infinite loop. That is, unless 
you rely on external input somehow, which you never told us about. You 
can easily do a while()-type loop in R, but whether that solves your 
problem is hard to tell.

Often the solution lies in whole-object thinking, and can end up quite 
different from index-fiddling, so it might help if you said what the 
actual problem is.