[R] How to *completely* stop a script after stop()?
Marius Hofert
m_hofert at web.de
Sat Jan 15 09:09:20 CET 2011
Dear expeRts,
is there a neat way to *completely* stop a script after an error occured?
For example, consider the following script:
## ==== file.R ====
for(i in 1:10){
print(i)
if(i == 5) stop("i == 5")
}
for(i in 11:100) print(i)
## ================
stop() behaves like it should namely to stop the execution of the *current*
expression, but I was wondering if it is possible to *really* stop the script after
the first for loop [so without executing the second for loop or anything after that
point]. Of course one could use something like "if(there was an error) do not continue"
but that's not really nice.
Cheers,
Marius
More information about the R-help
mailing list