[This post is inspired from this thread on R-help]

The suppressWarnings function allows to call a function and suppress whatever warning it might generate. This uses the calling handler and restart mechanism of R to invoke the special "muffleWarning" restart when a warning is detected by the handler.

The downside is that it removes all warnings, and this might not be what you want. Consider that simple function that gives two warnings:

f  f(5)
[1] 8
Warning messages:
1: In f(5) : bla bla
2: In f(5) : yada yada
> suppressWarnings( f(5) )
[1] 8

What if I wanted to remove "bla bla" warnings and not "yada yada" warnings, because I know that "bla bla" warnings are expected and are more disturbing that useful. Currently, suppressWarnings does not offer that possibility, but you can make you own calling handler that handles warnings the way you want:

> h  withCallingHandlers( f(5), warning = h )
[1] 8
Warning message:
In f(5) : yada yada