Skip to contents

This function silences warnings, messages and any cat() or print() output from R expressions or functions.

Usage

quiet(x, print_cat = TRUE, message = TRUE, warning = TRUE)

Arguments

x

[expression]
Any function or expression or value assignment expression.

print_cat

[logical(1)]
Silence print() and cat() outputs?

message

[logical(1)]
Silence messages?

warning

[logical(1)]
Silence warnings?

Value

Invisibly the expression x.

References

This function is a modified version of quiet.

See also

Examples

f <- function() {
  warning("warning")
  message("message")
  cat("cat")
  print("print")
}
quiet(f())