Debugging and Testing in R
Lecture Slides Lecture Slides (pdf) Lecture Slides (ipynb)
Tutorial Exercise Tutorial Exercise (pdf) Tutorial Exercise (ipynb)
Finding and eliminating errors in code is one of (if not the most) frustrating part of computer programming. This week we focus on how to debug and test an R program. We start with the usage of print() statement to analyse the state of function calls and loops. Afterwards, we discuss more structured ways of error-catching and debugging with the help of built-in R debugger.
Required Readings
- Wickham Chs 8 Conditions, 22 Debugging;
- Peng Ch 20: Debugging;
Additional Readings
- Matloff Ch 13: Debugging.
Tutorial
- Debugging functions;
- Using debugger in R.
Assignment 2 (Blackboard)
- R basics and control flow.
- Due at 12:00 on Monday, 27th October (submission on Blackboard);
- Rename the file from
02_assignment.ipynbto02_assignment_lastname_firstname_studentnumber.ipynbbefore submission.