Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

msg_cat

Generate a message with cat()


Description

This function is similar to message(), and the difference is that msg_cat() uses cat() to write out the message, which is sent to stdout instead of stderr. The message can be suppressed by suppressMessages().

Usage

msg_cat(...)

Arguments

...

Character strings of messages, which will be concatenated into one string via paste(c(...), collapse = '').

Value

Invisible NULL, with the side-effect of printing the message.

Note

By default, a newline will not be appended to the message. If you need a newline, you have to explicitly add it to the message (see ‘Examples’).

See Also

This function was inspired by rlang::inform().

Examples

{
    # a message without a newline at the end
    xfun::msg_cat("Hello world!")
    # add a newline at the end
    xfun::msg_cat(" This message appears right after the previous one.\n")
}
suppressMessages(xfun::msg_cat("Hello world!"))

xfun

Miscellaneous Functions to Support Packages Maintained by 'Yihui Xie'

v0.22
MIT + file LICENSE
Authors
Yihui Xie [aut, cre, cph] (<https://orcid.org/0000-0003-0645-5666>), Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Christophe Dervieux [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.