[R] on abort error, always show call stack?
Matt Shotwell
shotwelm at musc.edu
Sun Aug 22 17:50:58 CEST 2010
On Sun, 2010-08-22 at 11:41 -0400, ivo welch wrote:
> Dear R Wizards---is it possible to get R to show its current call
> stack (sys.calls()) upon an error abort? I don't use ESS for
> execution, and it is often not obvious how to locate how I triggered
> an error in an R internal function. Seeing the call stack would make
> this easier. (right now, I sprinkle "cat" statements everywhere, just
> to locate the line where the error appears.) Of course, I would
> really love to see the line in my program that triggered this, but I
> have asked this before, and I understand this is too difficult to get
> into the R language.
The traceback() function will print out the call stack after an error.
However, you may find the debug() family of functions more useful for
debugging. Also see the browser() function.
-Matt
>
> regards,
>
> /iaw
>
> ----
> Ivo Welch (ivo.welch at brown.edu, ivo.welch at gmail.com)
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
--
Matthew S. Shotwell
Graduate Student
Division of Biostatistics and Epidemiology
Medical University of South Carolina
More information about the R-help
mailing list