Learn R Programming

fuj (version 0.2.1)

muffle: Muffle messages

Description

Aliases for base::suppressMessages() and base::suppressWarnings()

Usage

muffle(expr, fun, classes = "message")

wuffle(expr, fun, classes = "warning")

Value

The result of expr or a function wrapping fun

Arguments

expr

An expression to evaluate

fun

A function to muffle (or wuffle)

classes

A character vector if classes to suppress

Examples

Run this code

# load function
foo <- function(...) {
  message("You entered :", paste0(...))
  c(...)
}

# wrap around function or muffle the function ti's
muffle(foo(1, 2))
muffle(fun = foo)(1, 2)
sapply(1:3, muffle(fun = foo))

# silence warnings
wuffle(as.integer("a"))
sapply(list(1, "a", "0", ".2"), wuffle(fun = as.integer))

Run the code above in your browser using DataLab