[Rd] Capturing all warnings (with messages)

2009-02-04 Thread Jon Clayden
Dear all, For an open-source project that I'm working on (1), which uses R for all its heavy lifting but includes a wrapper shell script, I was hoping to find a way to capture all warnings (and, in fact, errors too), and handle them in my own way. I realise I can do this for a single

Re: [Rd] Capturing all warnings (with messages)

2009-02-04 Thread Jeffrey Horner
Jon Clayden wrote on 02/04/2009 06:59 AM: Dear all, For an open-source project that I'm working on (1), which uses R for all its heavy lifting but includes a wrapper shell script, I was hoping to find a way to capture all warnings (and, in fact, errors too), and handle them in my own way. I

Re: [Rd] Capturing all warnings (with messages)

2009-02-04 Thread Jon Clayden
Dear Jeff, Many thanks for the suggestion, but I don't think tryCatch() is the answer, mainly because it causes code to stop executing when a warning is signalled: f - function(w) print(w$message) tryCatch({warning(Test); print(3)},warning=f) [1] Test (The print(3) call is not run.) In this

Re: [Rd] Capturing all warnings (with messages)

2009-02-04 Thread Jeffrey Horner
Jeffrey Horner wrote on 02/04/2009 01:19 PM: Jon Clayden wrote on 02/04/2009 12:11 PM: Dear Jeff, Many thanks for the suggestion, but I don't think tryCatch() is the answer, mainly because it causes code to stop executing when a warning is signalled: f - function(w) print(w$message)

Re: [Rd] Capturing all warnings (with messages)

2009-02-04 Thread hadley wickham
Hi Jon, I have an in-development package that attempts to do this. It's called eval.with.details and is available from http://github.com/hadley/eval.with.details. As you might guess, it's a version of eval that captures all details like messages, warnings, errors and output so you can do

Re: [Rd] Capturing all warnings (with messages)

2009-02-04 Thread Jon Clayden
Jeff, Hadley, Many thanks for your responses. The eval.with.details package sounds interesting and I'll certainly take a closer look, but it still seems to me that these approaches are focussed on trapping warnings within specific snippets of code rather than changing the way all warnings

Re: [Rd] Capturing all warnings (with messages)

2009-02-04 Thread William Dunlap
wickham Cc: R-devel@r-project.org Subject: Re: [Rd] Capturing all warnings (with messages) Jeff, Hadley, Many thanks for your responses. The eval.with.details package sounds interesting and I'll certainly take a closer look, but it still seems to me that these approaches are focussed

Re: [Rd] Capturing all warnings (with messages)

2009-02-04 Thread luke
-boun...@r-project.org] On Behalf Of Jon Clayden Sent: Wednesday, February 04, 2009 4:31 PM To: hadley wickham Cc: R-devel@r-project.org Subject: Re: [Rd] Capturing all warnings (with messages) Jeff, Hadley, Many thanks for your responses. The eval.with.details package sounds interesting and I'll