Rev 40650 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{message}\alias{message}\alias{suppressMessages}\alias{packageStartupMessage}\alias{.packageStartupMessage}\alias{suppressPackageStartupMessages}\alias{.makeMessage}\title{Diagnostic Messages}\description{Generate a diagnostic message from its arguments.}\usage{message(\dots, domain = NULL, appendLF = TRUE)suppressMessages(expr)packageStartupMessage(\dots, domain = NULL, appendLF = TRUE)suppressPackageStartupMessages(expr).makeMessage(\dots, domain = NULL, appendLF = FALSE)}\arguments{\item{\dots}{zero or more objects which can be coerced to character(and which are pasted together with no separator) or (for\code{message} only) a single condition object.}\item{domain}{see \code{\link{gettext}}. If \code{NA}, messages willnot be translated.}\item{appendLF}{logical: should messages given as a character stringhave a newline appended?}\item{expr}{expression to evaluate.}}\details{\code{message} is used for generating \dQuote{simple} diagnosticmessages which are neither warnings nor errors, but neverthelessrepresented as conditions. Unlike warnings and errors, a finalnewline is regarded as part of the message, and is optional.The default handler sends the message to the\code{\link{stderr}()} connection.If a condition object is supplied to \code{message} it should bethe only argument, and further arguments will be ignored, with a warning.While the message is being processed, a \code{muffleMessage} restartis available.\code{suppressMessages} evaluates its expression in a context thatignores all \dQuote{simple} diagnostic messages.\code{packageStartupMessage} is a variant whose messages can besuppressed separately by \code{suppressPackageStartupMessages}. (Theyare still messages, so can be suppressed by \code{suppressMessages}.)\code{.makeMessage} is a utility used by \code{message}, \code{warning}and \code{stop} to generate a text message from the \code{\dots}arguments by possible translation (see \code{\link{gettext}}) andconcatenation (with no separator).}\seealso{\code{\link{warning}} and \code{\link{stop}} for generating warningsand errors; \code{\link{conditions}} for condition handling andrecovery.\code{\link{gettext}} for the mechanisms for the automated translationof text.}\examples{message("ABC", "DEF")suppressMessages(message("ABC"))testit <- function() {message("testing package startup messages")packageStartupMessage("initializing ...", appendLF = FALSE)Sys.sleep(1)packageStartupMessage(" done")}testit()suppressPackageStartupMessages(testit())suppressMessages(testit())}\keyword{programming}