There doesn't seem to be any examples of 'next' usage in the control flow help page. I'd like it to skip to the next iteration based on a condition within the script.
Using the example below, let's say I don't want it to print, unless x[i] > 5
, the expected output would be 5 through 10 on screen:
x <- 1:100
for(i in 1:10) {
# next(x[i] < 5) # Just for conceptualizing my question.
print(x[i])
}
How would I go about implementing the use of next
to accomplish something like what's shown above?