From thomas.friedrichsmeier at ruhr-uni-bochum.de  Wed Mar  6 13:12:00 2013
From: thomas.friedrichsmeier at ruhr-uni-bochum.de (Thomas Friedrichsmeier)
Date: 6 Mar 2013 13:12:00 +0100
Subject: [Rd] Printing warning messages around R_tryEval
Message-ID: <201303061312.05899.thomas.friedrichsmeier@ruhr-uni-bochum.de>

Hi!

In RKWard we use R_tryEval() at a number places to run R commands. In order to 
make sure that any generated warnings become visible close to the problem, we 
were following up (most of) these calls with Rf_PrintWarnings().

Rf_PrintWarnings() was never available in the headers (as far as I know), and 
in r61771 the symbol has been hidden from libR.so. So this solution is no 
longer available. Could you give advice on the best way to print warnings 
before returning to the top level?

Some available options, I am aware of:
1. Call R function warnings(). However, this will always print the latest 
warning, even if it was generate by some earlier command. I would need a way 
to print new warnings, only.

2. Use options(warn=1) where applicable. However, in some cases, collecting 
warnings until some procedure is complete, and printing them then, would be 
preferrable.

3. I see there is an internal call printDeferredWarnings(), which seems to be 
almost exactly what I want. However, using an .Internal() does not look like a 
terribly stable solution, either. Also, having direct access to a similar 
function from the C-API would be very comfortable.

Thanks!
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20130306/af4f758a/attachment.bin>


[Rd] Printing warning messages around R_tryEval
Thomas Friedrichsmeier