reTry | R Documentation |
Tries to call fun
. If the call results in an error, the error is
logged and after some time it is tried again. If the final try results in an
error the function throws an error. Otherwise th result of fun is returned.
reTry(fun, ..., tries = 1, intSleep = 0, errorLogging = flog.error)
fun |
(function) a function |
... |
arguments passed to |
tries |
(numeric > 0) number of tries |
intSleep |
(numeric >= 0) interval in seconds between tries |
errorLogging |
(function) a function which is called in case of an error with
|
## Something that will fail every once in a while:
try(reTry(
function() if (runif(1) > 0.5) stop(),
tries = 2,
intSleep = 1
))
## Disable logging
noErrorLogging <- function(x, ...) NULL
try(reTry(
function() stop(),
errorLogging = noErrorLogging
))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.