I often run my scripts from an R terminal with source('my_script.r')
. I would like be able to use a statement in my scripts that quietly terminate execution of the script anywhere I type it and that returns control to the terminal, where I can inspect my variables.
The answers to this thread suggest using
q()
or
stop()
to stop an R script, but q()
exits the session, and stop()
throws an exception and is not quiet (especially if I have something like options(error=traceback)
activated, since it forces R to print the call stack).
Is there a way to quietly stop execution of the script and return control to the R terminal with a short command?