5

I just started with debugging in rstudio. At the beginning everything worked as described here.

enter image description here

After I used browser(), I cannot get back to this status, that means there is no interactive field, where I can press the hide traceback or return with debug button. Does anybody know, what is going wrong?

RStudio Version

platform x86_64-w64-mingw32
arch x86_64
os mingw32
system x86_64, mingw32
status
major 3
minor 2.2
year 2015
month 08
day 14
svn rev 69053
language R
version.string R version 3.2.2 (2015-08-14) nickname Fire Safety

Please let me know if you also need all options() settings.

Edit November 2018: Run a script with an error an interactive traceback active.

getOption("error")
(function () 
{
    .rs.recordTraceback(FALSE, 5, .rs.enqueueError)
})()

Destroy interactive traceback (No idea, what I did):

getOption("error")
(function () 
{
    .rs.recordTraceback(FALSE, 5, .rs.enqueueError)
})()

Thus, settings are the same and it unclear what happens...

Christoph
  • 6,841
  • 4
  • 37
  • 89

2 Answers2

1

I had the same behavior. After programmatically setting the error option in R to browser, traceback or recover, the button in RStudio (Debug/On Error) didn't work anymore.

To resolve this I had to first reset the error option to it's default value NULL. After that I could get back the interactive debugger.

The following resets the option first to NULL and then sets the option to the behavior that you get with selecting (Debug/On Error/Error Inspector) in RStudio.

options(error = NULL)
options(error = function(){.rs.recordTraceback(TRUE)})
symbolrush
  • 7,123
  • 1
  • 39
  • 67
  • The following works for me: 1. options(error = NULL) 2. RStudio => Debug => On Error => Error Inspector However, it only works ONCE. Afterwards I have to do the same process again to make it work again. The following does not work: 1. options(error = NULL) 2. options(error = function(){.rs.recordTraceback(TRUE)}) – Christoph Apr 12 '16 at 07:34
  • See discussion [here](https://support.rstudio.com/hc/en-us/community/posts/218745527-No-traceback-or-R-code-information-when-error?page=1#community_comment_115000020928) – Christoph Dec 16 '16 at 08:25
  • Link appears to be dead as of December 2019 – ohnoplus Nov 30 '19 at 04:18
0

Running options(error = traceback) in console will output the traceback messages, but it will not work after restart RStudio. That is, you need to run options(error = traceback) every time launching RStudio. enter image description here

CcMango
  • 377
  • 1
  • 4
  • 15