[Rd] Capturing warnings with capture.output

hadley wickham h.wickham at gmail.com
Tue Aug 29 16:46:14 CEST 2006


Is there any way to include warnings in the output from capture.output?  eg:

a <- capture.output(warning("test"))
all.equal(a, "Warning message: \n test ")

Conceptually, this seems like redirecting stderr to stdout, or somehow
changing warning to simple print it's output.  I've had a look at
tryCatch and using a warning handler, but this terminates execution at
the warning.

Thanks,

Hadley



More information about the R-devel mailing list