Using browser() was convenient because breakpoints could be set directly in functions. However, R does modify those functions altering line numbers and possibly introducing other non-function code. It also doesn't include expression-level sys.call() information the same way debug() does.
So now I've fully swapped over to using debug(). This means I need to step through the function manually to stop at breakpoints, but it is much more faithful to the actual R code and gives line-level information.
One downside is that there's a huge amount of noise from base R debug output, but I think that's more manageable than the browser() downsides.
A huge refactor of the
browser()
-based debugging.Using
browser()
was convenient because breakpoints could be set directly in functions. However, R does modify those functions altering line numbers and possibly introducing other non-function code. It also doesn't include expression-levelsys.call()
information the same waydebug()
does.So now I've fully swapped over to using
debug()
. This means I need to step through the function manually to stop at breakpoints, but it is much more faithful to the actual R code and gives line-level information.One downside is that there's a huge amount of noise from base R debug output, but I think that's more manageable than the
browser()
downsides.