[R] Redirecting Messages and Errors to a file

Thomas Lumley tlumley at u.washington.edu
Wed Jul 27 16:37:28 CEST 2005

On Wed, 27 Jul 2005, McGehee, Robert wrote:

> However, the sink() does not seem to be capturing the error messages as
> I would have hoped. That is, if the R-script is {print("abc");
> stop("def")}, the print output is captured to the file, the stop error
> message is not, and instead sent to the screen.
> Any thoughts on how to do this such that everything is sent to the file
> for emailing? Perhaps something different all together?

There is a separate output connection for errors.  The help page for 
sink() describes how to divert it, and warns of risks in doing so.


More information about the R-help mailing list