squashWarnings: Catch any warnings & convert them to messages

Description Usage Arguments Value Author(s) Examples

Description

Evaluate an expression which may generate warnings. Instead of printing the often terse warning to stderr, instead catch the warnings, print them to stdout using the message mechanism.

Usage

1

Arguments

expr

an expression that might generate a warning

Value

The result of executing expression. One message is returned per warning, with each message having the form ‘WARNING: w\$message’

Author(s)

Mark Cowley

Examples

1
2
3
4
5
6
# no warning or error
squashWarnings(1:5)
# warning thrown
squashWarnings(warning("My warning message"))
# errors are still thrown:
squashWarnings(log("x"))

drmjc/mjcbase documentation built on May 15, 2019, 2:27 p.m.