The function is used as a fail-safe if your R code sometimes works and sometimes doesn't, usually because it depends on a resource that may be temporarily unavailable. It tries to evaluate the expression `max_tries` times. If all the attempts fail, it throws an error; if not, the evaluated expression is returned.
Arguments
- expr
The expression to be evaluated.
- max_tries
The maximum number of attempts to evaluate the expression before giving up. Default is set to 5.
- error_message
a string, additional custom error message you would like to be displayed when an error occurs.
- retry_message
a string, a message displayed when a new try to evaluate the expression would be attempted.