Hi R experts,
I am looking for a simple error handling approach, whereby I could stop
function execution with a customized error message. For example:
for (i in 1:10) {
if (i == 5)
# I'd like to be able to stop right here with an error message I have
complete control over
}
The problem with stop() is that I cannot control completely what gets
printed to the terminal, even with stop(call.=FALSE) there is the "Error:"
string. I've worked through examples (whatever few there are) for try() and
tryCatch() and I still cannot understand how to do this. If I supply my own
error handler function with tryCatch(..., error=function(e) ...) I can
control the error message, but the loop continues on to i=6, etc.
So I am struggling with error handling in R... It' seems its a lot simpler
and more consistent e.g. in Python.
Any help would be greatly appreciated!
Aleksey
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.