问题 I'm trying to manually increment the i variable when a condition is met. for(i in 1:x){ if(condition){ i <- i + 2 } } When debugging, the (i<-i+2) line is definitely being run, but i still only increments by 1, instead of 3. (+2 from the line and an additional +1 from the auto increment) How can I increment while I'm within the loop? 回答1: So essentially you want to skip a few loop iterations based on a condition. It's a design choice that's rightfully frowned upon, but if you must, you need