Re: [R] how to stop without error message?

From: hadley wickham <h.wickham_at_gmail.com>
Date: Mon, 10 Nov 2008 21:19:55 -0600

>
> I should have been clearer, sorry-- I'm trying to exit from an "inner" function which might be several levels deep, returning straight to the R prompt. To be specific, I'm trying to clean up the "No Error in..." message in my 'debug' package-- the "No " prefix being my original workaround to avoid an unnecessarily alarming message.

Ah, ok. How about signalling custom condition then?

f <- function() {
  print("a")
  g()
  print("d")
}

g <- function() {
  print("b")
  error <- simpleError("")
  class(error) <- c("myerror", class(error))   signalCondition(error)
  print("c")
}

f()
tryCatch(f(), myerror = function(...) print("stopped!"))

Hadley

-- 
http://had.co.nz/

______________________________________________
R-help_at_r-project.org 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.
Received on Tue 11 Nov 2008 - 03:22:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Nov 2008 - 05:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive