Re: [Rd] capturing warnings using capture.output

2015-11-23 Thread William Dunlap
When options("warn") is 0, the default, the warning is not printed until capture.output is done. Use warn=1 to capture the warnings as messages: > options(warn=0) > txt0 <- capture.output({message("A message"); warning("A warning")}, > type="message") Warning message: In eval(expr, envir, enclos

[Rd] capturing warnings using capture.output

2015-11-23 Thread Richard Cotton
>From the Details section of ?capture.output: Messages sent to stderr() (including those from message, warning and stop) are captured by type = "message". Note that this can be "unsafe" and should only be used with care. Capturing messages works as expected: capture.output(message("!!!"), type =