Interactive debugger

Enter the interactive debugger is wwith RStudio’s “Rerun with Debug” tool. This reruns the command that created the error, pausing execution where the error occurred. Otherwise, you can insert a call to browser() where you want to pause, and re-run the function.

browser() is just a regular function call which means that you can run it conditionally by wrapping it in an if statement: