debug()

Another approach is to call a function that inserts the browser() call:

  • debug() inserts a browser statement in the first line of the specified function. undebug() removes it.

  • utils::setBreakpoint() works similarly, but instead of taking a function name, it takes a file name and line number and finds the appropriate function for you.