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

From: <>
Date: Tue, 11 Nov 2008 14:34:01 +1100

Thank you Hadley & John

Hadley's approach below is the kind of thing I was expecting-- I'd just never managed to figure out how to use tryCatch. John has also made me think that I could probably patch things up by modifying my calls to 'try'-- because sometimes I do want to print the error messages from the 'try's, it just depends on what they are. On balance, it's probably time for me to get to get to grips with 'tryCatch'.

Thanks again


Mark Bravington
CSIRO Mathematical & Information Sciences
Marine Laboratory
Castray Esplanade
Hobart 7001

ph (+61) 3 6232 5118
fax (+61) 3 6232 5012
mob (+61) 438 315 623

-----Original Message-----
From: hadley wickham []
Sent: Tuesday, 11 November 2008 2:20 PM
To: Bravington, Mark (CMIS, Hobart)
Subject: Re: [R] how to stop without error message?

> 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 -- ______________________________________________ mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code.
Received on Tue 11 Nov 2008 - 05:18:57 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 Please read the posting guide before posting to the list.

list of date sections of archive