Aborts the current expression call
Aborts the current expression call and returns to the top level prompt/browser without signaling a condition.
## Default S3 method: abort(..., call.=TRUE, domain=NULL)
... |
(optional) Objects coerced to |
call. |
If |
domain |
Used to translate the message (see |
There are still cases where one can "catch" the abort and undo it, cf. [1].
Returns nothing.
Henrik Bengtsson
[1] R-devel thread ”, Sept 11, 2012,
https://stat.ethz.ch/pipermail/r-devel/2012-September/064838.html.
throw
().
stop
().
Internally, invokeRestart
()("abort")
is utilized.
## Not run: foo <- function() { cat("foo()...\n") on.exit(cat("foo()...done\n")) tryCatch({ stop("Woops!") }, error = function(ex) { cat("An error was caught: ", ex$message, "\n", sep="") }) cat("Continuing...\n") } bar <- function() { cat("bar()...\n") on.exit(cat("bar()...done\n")) tryCatch({ abort("Woops!") }, error = function(ex) { cat("An error was caught: ", ex$message, "\n", sep="") }) cat("This message will never be displayed...\n") } # An error generated by stop() can be caught foo() # ...which is not possible when using abort() bar() # This expression is never reached cat("This line will never be outputted.\n") ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.