Control Flow in R
Lecture Slides Lecture Slides (pdf) Lecture Slides (ipynb)
Tutorial Exercise Tutorial Exercise (pdf) Tutorial Exercise (ipynb)
Straightline programs where each line of code gets executed one after another can get us only so far. In this week we focus on the key ways of controlling the flow of programs in R. We look at branching and loops, common for all programming languages and the details of their design and implementation in R.
Required Readings
- Peng Ch 14 Control Structures;
- Wickham Ch 5 Control Flow;
Additional Readings
- Matloff Ch 7 R Programming Structures.
Tutorial
- Conditional statements and iterations;
- Working with functions in R.