quiet: Silence (i.e., suppress or mute) printed messages from...

quietR Documentation

Silence (i.e., suppress or mute) printed messages from functions

Description

Silence messages from noisy functions. Optionally silence warning messages too.

Usage

quiet(expr, suppressWarnings = FALSE)

Arguments

expr

the expression that you desire to silence (i.e., the function along with its arguments)

suppressWarnings

a logical (TRUE or FALSE), noting whether you wish to suppress warning messages. The default is suppressWarnings = FALSE

Value

whatever should be returned by the expression that is being silenced

Examples


# Suppresses only messages
result <- quiet({
  message("This message is silenced")
  warning("This warning is shown")
  42  # Return a value
})

# Suppresses both messages and warnings
result <- quiet({
  message("This message is silenced")
  warning("This warning is silenced too")
  42  # Return a value
}, suppressWarnings = TRUE)



PHSKC-APDE/rads documentation built on April 14, 2025, 10:47 a.m.