How to edit and debug R library sources

Look up the trace and browser functions, they are the basic tools in R for debugging. Say you want to edit the source of function foo, then saying

trace("foo",edit=TRUE)

will open up the source of foo in the editor for you to change. However, this is for interactive debugging; the source files in the packages are not changed. So once you have found the bug, you need to change the package source files for the change to be permanent.

Leave a Comment