1

I am trying to run an R script on the command line and I want it to keep running even when there is an error. Is there a flag I can add to tell R to keep running through the script even when it encounters an error?

Right now it just halts execution when there is an error.

I also don't want to use methods like "try()" to wrap around the error lines because I have way too many of them and it's not possible for me to go through thousands of lines of code to catch all the error lines. I just want R to skip through the error lines when encountering them. Is there a way to do so?

Thank you!

dtsui
  • 29
  • 1
  • 9
  • 1
    This related SO question may provide some insight. https://stackoverflow.com/questions/14612190/is-there-a-way-to-source-and-continue-after-an-error – D.sen Sep 06 '17 at 20:57
  • 2
    You have to wrap your error prone statement into a `try` , but it'd complex to impossible to do it from command line. Can't you edit the r file ? – moodymudskipper Sep 06 '17 at 20:58
  • I can edit the R file but I would prefer not to. In fact, it would be impractical for me to do so since it's thousands of lines long and there are many errors that don't affect the script from doing its job (i'll clean it up at one point but I don't have the time now). I usually run the entire thing in R Studio which just skips over the error lines. Is there a flag I can add to command line when running the r script that skips all the error lines? Thanks! – dtsui Sep 06 '17 at 21:08

0 Answers0