suppress_mw: Suppress warnings and messages

View source: R/suppress_mw.R

suppress_mwR Documentation

Suppress warnings and messages

Description

\Sexpr[results=rd, stage=render]{lifecycle::badge("experimental")}

Run expression wrapped in both suppressMessages() and suppressWarnings().

Usage

suppress_mw(expr)

Arguments

expr

Any expression to run within suppressMessages() and suppressWarnings().

Details

suppressWarnings(suppressMessages(expr))

Value

The output of expr.

Author(s)

Ludvig Renbo Olsen, r-pkgs@ludvigolsen.dk

Examples

# Attach packages
library(xpectr)

fn <- function(a, b){
  warning("a warning")
  message("a message")
  a + b
}

suppress_mw(fn(1, 5))

xpectr documentation built on Nov. 18, 2022, 5:10 p.m.