Skip to main content

Week 8: Control Flow & Iteration

Oct 28, 2026 · 2:00–4:40 PM · Bobst LL138

Before class

  • Read: R02Pro Ch 12
  • Review the newly released weekly exercise and prepare questions.
  • Complete Weekly Exercise 7 (due tonight at 11:59 PM).
  • 🔍 Proofreading corner: spot a typo or unclear passage in Ch 12? Submit a PR or issue for extra credit (see syllabus).

Topics

  • Conditional execution: if, else if, else
  • Vectorized conditionals: ifelse() and dplyr::case_when()
  • Iteration with for loops: sequence iteration and pre-allocating output vectors
  • While loops and repeat loops
  • Loop control: next and break

Materials

Due

  • Weekly Exercise 7 (due tonight at 11:59 PM)
  • In-class exercise 8 (pushed to GitHub by end of class)