Re: [Rd] suppress *specific* warnings?

From: Prof Brian Ripley <>
Date: Fri, 26 Oct 2012 13:20:18 +0100

On 26/10/2012 12:04, peter dalgaard wrote:
> On Oct 26, 2012, at 11:17 , Martin Maechler wrote:
>>>>>>> Duncan Murdoch <>
>>>>>>> on Thu, 25 Oct 2012 06:51:25 -0400 writes:
>>> On 12-10-25 5:28 AM, Martin Maechler wrote:
>>>> Sorry guys, for coming late,
>>>> but *please* don't go there.
>>>> I've been there years ago,
>>>> and found later why the approach is flawed "by design" :
>>>> Internationalization / Localization:
>>>> - If the warning comes from a "standard R" function,
>>>> the warning is almost surely different in a (say) German
>>>> locale, and your pattern won't be detected.
>>>> - Ditto if from a recommended package.
>>>> - If it is a warning that is not translated then it may be that
>>>> it is just not *YET* translated.
>>> I think the other Martin's suggestion addressed this: he matched the
>>> translated message, not the English original.
>>> Duncan Murdoch
>> Well, I don't think I understand.
>> Of course you can only match "the message" that warning() or
>> error() {or rather tryCatch() ,...} produces.
>> But you cannot guarantee nor know (for sure) if that message is 'original'
>> or translated.
>> "cannot", because AFAIK
>> we cannot guarantee Sys.setlocale() is obeyed platform
>> independently:
>> You would have to query the current and save that, set it to C, get the
>> message, and then reset the locale to the previously saved one.
>> And these do not work reliably, on some platforms, AFAIK and
>> read our documentation.
> I think the point was to use gettext() on the pattern-to-match. If
> the warning is translated, so would this be. The main limitations would seem
to be that you have to be d*mn sure to get the spelling right and, presumably, it only works with straight string translations, not variant forms like
> msgid "found %d fatal error"
> msgid_plural "found %d fatal errors"
> msgstr[0] "s'ha trobat %d error fatal"
> msgstr[1] "s'han trobat %d errors fatals"

Yes: you also need to get the domain right (and it would be unsafe not to specify it on the gettext() call). And C-level messages do move between domains; for example between R 2.15.x and R-devel most of the graphics ones have moved from 'R' to 'graphics'.

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Fri 26 Oct 2012 - 12:24:04 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 Fri 26 Oct 2012 - 15:50:49 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive