Sublime Forum

how to stop script if errors occur running multiple lines using Sublime text 3 with R


I was an user of tinnR as script editor for R. With that editor, when running a selection of multiple lines at once, the behaviour was the following:

  • on the R console it was appearing only one line (i.e. a line with the tinnR command to run the mupltiple line selection)
  • the selected lines were ran ONLY up to the point where an error occurred. For example, if 10 lines were sent to R and the error was in the line 5, only the output of the first 4 lines was avaible in R and NONE of the lines from 6 to 10 would have been ran.

Is there a way to have Sublime text 3 doing anything like that? I’m interested in particular in the second point: stopping the script as soon as an error occurs.

I often run a bunch of lines at the same time and If one or multiple errors occur they can go undetected with potentially bad consequences (e.g. an object saved when not correct but wth no way of having a warning).

any suggestion is welcome.



I’m not familiar with R at all, but if anything is executing code, it’s doing it by telling some external program (such as the R interpreter) to do it. So something like this comes down to whether or not that tool can be told/configured to stop when it encounters an error.