silently returns a new function that will returns an error or a warning if any, or else returns nothing.

silently(.f)

Arguments

.f

the function to silence

Value

an error if any, a warning if any. The result is never returned.

Examples

if (FALSE) { # \dontrun{
silent_log <- silently(log)
silent_log(1)
silent_log("a")
} # }