1

I am looking for a way to put a breakpoint during an execution of an R script either using Rscript script.R or R --vanilla --silent -f script.R.

I'd expect that R --vanilla --slave -e 'browser()' would not just output Called from: top level and exit, but instead break and open the Browse[1]> > shell.

Is there a way to achieve that in R using browser(), debugger(), etc?

nikola
  • 5,286
  • 3
  • 22
  • 19
  • Can you describe why you want to do this? – Dason Mar 22 '17 at 15:58
  • So what exactly is the goal here? You want to be able to step through all the lines of a script file in the browser environment? Even if you were to call `browser()` explicitly in the script you generally don't set to step through subsequent calls, you only get to debug and step-in the current execution environment. Is this what you want: http://stackoverflow.com/questions/7486386/how-to-step-through-an-r-script-from-the-begining – MrFlick Mar 22 '17 at 15:59
  • @Dason I have an automated shell script that runs my test suite by building the R package, setting databases and seed data and calling `Rscript tests/test_suite.R`, which runs the tests. I would like to be able to set breakpoints there and have the R command interrupted. I could of course just open an R session and manually call the script, but that's more tedious with my workflow. – nikola Mar 23 '17 at 09:48
  • @MrFlick thanks for the referred answer - from that I am getting that what I want to do will not be possible. This nevertheless surprises me though. – nikola Mar 23 '17 at 09:53

0 Answers0