[R] on abort error, always show call stack?
Charles C. Berry
cberry at tajo.ucsd.edu
Sun Aug 22 17:57:53 CEST 2010
On Sun, 22 Aug 2010, Matt Shotwell wrote:
> 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.
>
Further, you might set
options( error = recover )
which "prints the list of current calls, and prompts the user to select
one of them." And then allows browser()-ing.
Chuck
> -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
>
> ______________________________________________
> 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.
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
More information about the R-help
mailing list