Learn R Programming

SoDA (version 1.0-6.1)

muststop: Test for an expression that should result in an error

Description

This function tests the assertion that there is an error in the expression and therefore that evaluating it will generate an error condition.

Usage

muststop(expr, silent = TRUE)

Arguments

expr

Any R expression

silent

if FALSE, the error message will be reported.

Value

If an error is generated, the function returns the corresponding condition object; if not, then muststop() will itself generate an error.

See Also

stopifnot

Examples

Run this code
# NOT RUN {
muststop(sqrt("abc"))
# }

Run the code above in your browser using DataLab