Rev 82652 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/message.Rd% Part of the R package, https://www.R-project.org% Copyright 1995-2011 R Core Team% Distributed under GPL 2 or later\name{message}\alias{message}\alias{suppressMessages}\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, classes = "message")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, see also the note in \code{\link{stop}}.}\item{appendLF}{logical: should messages given as a character stringhave a newline appended?}\item{expr}{expression to evaluate.}\item{classes}{character, indicating which classes of messages shouldbe suppressed.}}\details{\code{message} is used for generating \sQuote{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}()} \link{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 \sQuote{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}