catch_warnings {EloSteepness}R Documentation

catch warnings alongside results without returning warning

Description

helper function

Usage

catch_warnings(expr)

Arguments

expr

an R expression to evaluate

Value

a list where the first entry is the result of expr and the second provides information about warnings

Source

demo(error.catching)

Examples

log(3)
catch_warnings(log(3))

# produces warning
# log(-3)
# catch it
catch_warnings(log(-3))

# produces error
# log("x")
# catch it
catch_warnings(log("x"))

[Package EloSteepness version 0.5.0 Index]