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
- 📊 Lecture Slides: Interactive Presentation (HTML)
- 📝 In-Class Exercise: View Worksheet (HTML) · Download Starter Code (
.qmd) · or runget_worksheet(8)in your in-class repo - 💻 Weekly Exercise 8: Accept Assignment on Classroom 50 · How to do it, start to finish
Due
- Weekly Exercise 7 (due tonight at 11:59 PM)
- In-class exercise 8 (pushed to GitHub by end of class)