13

Is there a way to make Rstudio tell you which line of which sourcefile generated a warning message? Right now it just prints the message and I am lost as to what is causing the issue.

In Rstudio, this menu option is checked: Debug > Error > Error Inspector

But it doesnt' help, probably because these are warnings and not errors? Ideas?

rstruck
  • 1,174
  • 4
  • 17
  • 27
  • 6
    You can tell R to treat warnings as errors with `options(warn=2)` – Matthew Plourde Mar 18 '15 at 20:39
  • 1
    @MatthewPlourde I ran that in the console and ran my shiny app again... so far, no difference. But thank you! – rstruck Mar 18 '15 at 20:50
  • Keep in mind "errors" are different than "warnings." Using an error inspector won't do anything for warnings. Matthew's suggestion should have turned warnings into errors. If you didn't see a difference, that would be odd. – MrFlick Mar 18 '15 at 20:52

1 Answers1

7

First turn on displaying warnings using the command options(warn=1) Then, you could run it by clicking on the "Source" or "Source with Echo" button (see image below). You can see the error/warning messages when any line with errors/warnings is executed.

enter image description here

Community
  • 1
  • 1
ConfusedMan
  • 562
  • 1
  • 4
  • 12
  • 1
    I see. It's almost as if shiny::runApp() vs source() on the app.R file do different things... but yeah... source seems to bring back the 'show traceback' thing to help with debugging. This explains why sometimes I saw it and sometimes I didn't. Cos sometimes I would use source but most times I've just been using runApp(). Thanks! – rstruck Mar 19 '15 at 03:12