Reputation: 2111
I'm developing a package for R. When I test it in the interactive R environment, I call traceback()
very often.
Is there a way for me to configure interactive R to always show the traceback()
message automatically when it encounters a runtime error? I don't want to have to type traceback()
every time.
Upvotes: 0
Views: 596
Reputation: 44788
Use
options(error = traceback)
and you'll automatically get a traceback when an error occurs. An even more useful choice is
options(error = utils::recover)
which prints something like a traceback but lets you examine the variables as they existed at the time of the error, or
options(error = utils::dump.frames)
which saves the variables so they can be examined later.
Any one of these commands could be put in your .Rprofile
file and they would automatically apply in any session that used it.
Upvotes: 2