check a function and if there's an error return an indication that we can ifelse() to either run for real or skip
Arguments
- f
report result of a try()
Value
TRUE/FALSE for error
Examples
sw_try_ok <-
!e_is_error(
try(
# try what you want, check for error
log(NULL)
)
)
#> Error in log(NULL) : non-numeric argument to mathematical function
if(sw_try_ok) {
# no error, do what you intended to do
} else {
# error, do something else
}
#> NULL