Debugging
Types of Bugs
- Define syntax and semantic errors.
- Compare and contrast syntax errors and semantic errors.
- Give examples of syntax errors and semantic errors in R.
- Given a bug in R code, identify whether it is a syntax error or a semantic error.
The Process of Debugging
- State the 4 main stages involved in debugging.
- Describe the sort of actions that can be taken during the stages of debugging.
traceback()
- Explain what
traceback()
does when run after encountering an error message.
- Given an error message and a call to
traceback()
, state the chain of functions that were called leading to the error.
- Use
traceback()
to help identify the bug leading to an error message.
- Use
browser()
to inspect the state of variables in a function.
- Use
browser()
to step through a function and into other functions.
- State the 5 main commands that are used after a call to
browser()
to step through code.
- Use
browser()
within RStudio, including the Environment and Traceback panes, to identify, characterize, and fix a bug in R code.