throws_error: Does call return an error?

View source: R/error_handling.R

throws_errorR Documentation

Does call return an error?

Description

Parses a string as a call and determines whether it returns an error or not. Returns a boolean.

Usage

throws_error(expr, silent_try = T)

Arguments

expr

(expr) An expression.

silent_try

(lgl scalar) Whether to use a silent try.

Examples

throws_error(log("")) #cannot take a logarithm of a string
throws_error(log(0)) #can take logarithm of 0
throws_error("log(0)") #works on strings too
throws_error("log(NULL)") #works on strings too

Deleetdk/kirkegaard documentation built on April 22, 2024, 5:22 p.m.