R’s message()
function generates diagnostic messages that are not errors or warnings.
message(…, domain = NULL, appendLF = TRUE)
The message()
function takes the following parameter values:
...
: This is a form of string(s) that is to be pasted together with no separator. This is a required parameter.domain
: This represents the domain for the translation. This is an optional parameter.appendLF
: This takes a logical value indicating whether the messages given as a character string should have a newline appended or not. This is an optional parameter.# Code to illustrate the message() functionmessage("Thirty four")message("Apple", "Banana", "Pineapple")
message()
function to return the character string passed to it as an argument.message()
function to return string characters pasted together with no separator.message()
function?The message()
function is better than the paste()
function when we want to concatenate strings, as it is shorter to write.
message("a", "b", "c")print(paste0("a", "b", "C"))
Line 1–2: We compare the message()
and the paste()
function.