View source: R/error_handling.R
retry_while_error | R Documentation |
Run an expression repeatedly until it doesn't produce an error or a max number of attempts has been reached.
retry_while_error(
expr,
retry_interval = 60,
silent = F,
max_tries = 10,
max_time = Inf
)
expr |
An expression. |
retry_interval |
(num) Time interval between retries in seconds. |
silent |
(lgl) Whether to output dated errors while trying is ongoing. |
max_tries |
(num) Max number of tries. |
max_time |
(num) Max time to try, including run and sleep time. |
The output of expr.
#this one eventually succeeds
retry_while_error(log(unlist(sample(list("", 0), size = 1, prob = c(1, .01)))), retry_interval = 0, max_time = Inf, max_tries = Inf, silent = T)
#note: these produce errors
retry_while_error(log(""), retry_interval = 0)
retry_while_error(log(""), retry_interval = 0, max_time = 1, max_tries = Inf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.