This lesson requires a premium membership to access.
Premium membership includes unlimited access to all courses, quizzes, downloadable resources, and future content updates.
R has three statements that provide explicit looping. They are for, while and repeat. Each of the three statements returns the value of the last statement that was evaluated. R also provides other functions for implicit looping such as tapply, apply, and lapply.
There are two statements that can be used to explicitly control looping. They are break and next. The break statement causes an exit from the innermost loop that is currently being executed. The next statement immediately causes control to return to the start of the loop. The next iteration of the loop (if there is one) is then executed. No statement below next in the current loop is evaluated.