[R] error death with backtrace --- how to "exit (0)"

ivo welch ivo.welch at gmail.com
Tue Nov 29 23:59:25 CET 2011


Dear R experts---I think I need to figure out how to stop in my error
function without triggering an error again.  so, I think I need the
equivalent of C's exit(0) call.  Here is what I mean:

$ R CMD BATCH die.R

and die.R is

# in my .Rprofile, but for now in die.R
options(error=function(e) print(traceback(sapply(sys.calls(), deparse))) )

f <- function()  stop("I want do stop here")
f()
stop("pgm should have stopped by now in my main code\n")
cat("still not stopped?  yikes!\n")


advice appreciated.

/iaw



More information about the R-help mailing list