Last data update: 2014.03.03

R: Check if an R expression produces warnings or errors
has_warningR Documentation

Check if an R expression produces warnings or errors

Description

The two functions has_warning() and has_error() check if an expression produces warnings and errors, respectively.

Usage

has_warning(expr)

has_error(expr)

Arguments

expr

an R expression

Value

A logical value.

Examples

has_warning(1 + 1)
has_warning(1:2 + 1:3)

has_error(2 - 3)
has_error(1 + "a")

Results