Skip to content
Back to formatted view

Raw Message

Message-ID: <CAPp_+=e8fcyxCCqVwxWuYZpZ+sXGJbm04Mw0Zf8MUuht9dh3kA@mail.gmail.com>
Date: 2015-11-23T10:31:05Z
From: Richard Cotton
Subject: capturing warnings using capture.output

>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 = "message")
## [1] "!!!"

Capturing warnings doesn't seems to work:

capture.output(warning("!!!"), type = "message")
## character(0)
## Warning message:
## In eval(expr, envir, enclos) : !!!

Is the documentation wrong, or is this a bug, or am I doing doing silly?

-- 
Regards,
Richie

Learning R
4dpiecharts.com

	[[alternative HTML version deleted]]