8) Iterations

📖 Lecture

This week we introduce the syntax used by R to handle iteration constructs such as for loops and while loops.

🎯 Objectives

Get familiar with the syntax used in R for writing

  • for loops
  • while loops
  • the next statement to skip iterations
  • the break statement to stop loops from iterating
  • and the family of apply() functions

📚 Reading

🔬 Lab

Work with some basic examples using loops in R.