Skip to content

executing from .R source file in the src package

2 messages · Larry, Duncan Murdoch

#
On 11-04-06 2:13 AM, Larry wrote:
I don't know ESS, but to get debug info in a package, you need to 
install the package with debug information included.  By default 
source() includes it, installed packages don't.

Setting the environment variable

R_KEEP_PKG_SOURCE=yes

before running

R CMD INSTALL foo.tar.gz

will install the debug information.  Then the browser, etc. will list 
filename and line number information.  This is also necessary for 
setBreakpoint to work, but then you'll also probably need to say which 
environments to look in, e.g.

setBreakpoint("Sweave.R#70", env=environment(Sweave))

will set a breakpoint in whatever function is defined at line 70 of 
Sweave.R, as long as that function lives in the same environment as Sweave.

Duncan Murdoch