if.error | R Documentation |
Does a given expression return an error? Return specific values/expressions for either case. Useful for loops when you want to easily control values based on errors that arise.
if.error(expr, error_true, error_false)
expr |
Expression to be tested for returning an error. |
error_true |
Value or expression to be executed if tested expression returns an error. |
error_false |
Value or expression to be executed if tested expression does not return an error. |
Returns value or expression stated in error_true
or error_false
,
depending on whether the tested expression throws an error.
Nick Bultman, njbultman74@gmail.com, September 2020
is.error
if.error( log(3), "error", "no_error" )
if.error( log(3), "error", log(3) )
if.error( log(3), log(6), "no_error" )
if.error( log("a"), log(6), log(3) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.