[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  message: Diagnostic Messages

##  Description

Generate a diagnostic message from its arguments.

##  Usage

    
    
    message(…, domain = NULL, appendLF = TRUE)
    suppressMessages(expr)
    
    packageStartupMessage(…, domain = NULL, appendLF = TRUE)
    suppressPackageStartupMessages(expr)
    
    .makeMessage(…, domain = NULL, appendLF = FALSE)

##  Arguments

…

zero or more objects which can be coerced to character (and which are pasted
together with no separator) or (for ` message ` only) a single condition
object.

domain

see ` [ gettext ](/link/gettext?package=base&version=3.6.2) ` . If ` NA ` ,
messages will not be translated, see also the note in ` [ stop
](/link/stop?package=base&version=3.6.2) ` .

appendLF

logical: should messages given as a character string have a newline appended?

expr

expression to evaluate.

##  Details

` message ` is used for generating ‘simple’ diagnostic messages which are
neither warnings nor errors, but nevertheless represented as conditions.
Unlike warnings and errors, a final newline is regarded as part of the
message, and is optional. The default handler sends the message to the ` [
stderr ](/link/stderr?package=base&version=3.6.2) () ` [ connection
](/link/connection?package=base&version=3.6.2) .

If a condition object is supplied to ` message ` it should be the only
argument, and further arguments will be ignored, with a warning.

While the message is being processed, a ` muffleMessage ` restart is
available.

` suppressMessages ` evaluates its expression in a context that ignores all
‘simple’ diagnostic messages.

` packageStartupMessage ` is a variant whose messages can be suppressed
separately by ` suppressPackageStartupMessages ` . (They are still messages,
so can be suppressed by ` suppressMessages ` .)

` .makeMessage ` is a utility used by ` message ` , ` warning ` and ` stop `
to generate a text message from the ` … ` arguments by possible translation
(see ` [ gettext ](/link/gettext?package=base&version=3.6.2) ` ) and
concatenation (with no separator).

##  See Also

` [ warning ](/link/warning?package=base&version=3.6.2) ` and ` [ stop
](/link/stop?package=base&version=3.6.2) ` for generating warnings and errors;
` [ conditions ](/link/conditions?package=base&version=3.6.2) ` for condition
handling and recovery.

` [ gettext ](/link/gettext?package=base&version=3.6.2) ` for the mechanisms
for the automated translation of text.

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fmessage&utm_source=r-docs&utm_medium=docs&utm_term=message&utm_content=run_example_in_workspace)

    
    
    # NOT RUN {
    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())
    # }
    

Run the code above in your browser using  [ DataCamp Workspace
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fmessage&utm_source=r-docs&utm_medium=docs&utm_term=message&utm_content=run_example_in_workspace)

Powered by  [ DataCamp ](https://www.datacamp.com/)