retry | R Documentation |
An expression is executed using [base::try()] and re-run until it raises no more errors or until a maximum number of evaluations is reached. In the latter case, it raises an error of its own.
retry(expr, n = 5)
expr |
An expression to try to execute. |
n |
Maximum number of times to try to run the expression. |
This was primarily developed to robustly query websites. Sometimes a query fails or produces output which raises an error; this function issues a retry in such a case.
The output of the expression.
Sercan Kahveci
k <- 0
retry({k <<- k+1; if(k<4){ stop()}})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.