Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RStudio enters debug mode for every function error - how can I stop it?

I've been using RStudio for years, and this has never happened to me before. For some reason, every time a function throws an error, RStudio goes into debug mode (I don't want it to). Even after using undebug() on a single function.

> undebug(http.get) Warning message: In undebug(fun) : argument is not being debugged > x = http.get(country = 'KE')  http --timeout=60 get "http://[email protected]/observation?country=KE" > freshobs.json </dev/null Error in fromJSON(file = "freshobs.json") : unexpected character 'O'  Error in el[["product_name"]] : subscript out of bounds Called from: grepl(el[["product_name"]], pattern = "json:", fixed = T) Browse[1]> Q 

Any function I use that breaks causes debug mode to start - which is pretty annoying because it opens up a source viewer and takes you away from your code. Anybody know how to stop this functionality? This happens when the 'Use debug mode only when my code contains errors' check box in Preferences is and is not checked.

Thanks!

like image 340
Hillary Sanders Avatar asked Mar 12 '15 19:03

Hillary Sanders


People also ask

How do I stop a debug function in R?

The R function browser() halts execution and invokes an environment browser when it is called. You can put browser() anywhere in your code to stop at that point in the code for debugging.

How do I turn debug mode off?

To disable USB Debugging mode: Go to Settings and scroll to the System section (on Android 8 and above, go to Settings > System) Tap Developer Options. Tap the button to toggle developer options Off.

How do I disable debug mode in Visual Studio code?

To enable or disable Just My Code in Visual Studio, under Tools > Options (or Debug > Options) > Debugging > General, select or deselect Enable Just My Code.


1 Answers

I tried fixing this issue by putting options(error = NULL) in my .Rprofile, but this did not work.

What did work was to go to the "Debug" -> "On Error" menu and select "Message only". This effectively is the same as setting options(error = NULL), but it is persistent across restarts.

RStudio menu

like image 177
Maehler Avatar answered Sep 25 '22 13:09

Maehler