Skip to content
Prev 31268 / 63424 Next

Capturing all warnings (with messages)

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:
[1] "Test"

(The "print(3)" call is not run.) In this regard,
withCallingHandlers() is preferable. But either way it is untidy, at
best, to routinely put code inside one of these functions when I know
I always want to handle warnings my way. If I could set an appropriate
option when a package is loaded, or in an .Rprofile, then I should
never need to worry about whether a bit of code might generate
warnings and so should be wrapped.

Regards,
Jon

2009/2/4 Jeffrey Horner <jeff.horner at vanderbilt.edu>: