[Rd] Suppress specific warnings

Brian Lee Yung Rowe rowe at muxspace.com
Thu Apr 18 18:12:26 CEST 2013

For my logging package (futile.logger) any log statements coming from a package are assigned to a package namespace. This way you have control of log messages at a package level (e.g. I can set the default log threshold to DEBUG, while package 'A' has a log threshold of WARN). 

I seems a hierarchical namespace facility would work for the below case as well. 

On Apr 18, 2013, at 9:29 AM, Martin Morgan <mtmorgan at fhcrc.org> wrote:

>> To suppress just this one, try this:
>> withCallingHandlers(x + 1:3,
>>    warning=function(w) {
>>       if (grepl("longer object length", w$message))
>>          invokeRestart("muffleWarning")
>>    } )
> ...which are then caught as
>  withCallingHandlers({
>      warning(w)                   # 'curves'; caught
>      warning("another warning")
>  }, curves=function(w) invokeRestart("muffleWarning"))
> The tricky part is to come up with an appropriate scheme for classifying warnings.

Brian Lee Yung Rowe
917 496 4583

More information about the R-devel mailing list