Debian Codegraph @

man/retry.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/utils.R
3 \name{retry}
4 \alias{retry}
5 \title{Retry calling a function for a number of times}
6 \usage{
7 retry(fun, ..., .times = 3, .pause = 5)
8 }
9 \arguments{
10 \item{fun}{A function.}
11
12 \item{...}{Arguments to be passed to the function.}
13
14 \item{.times}{The number of times.}
15
16 \item{.pause}{The number of seconds to wait before the next attempt.}
17 }
18 \description{
19 If the function returns an error, retry it for the specified number of
20 times, with a pause between attempts.
21 }
22 \details{
23 One application of this function is to download a web resource. Since the
24 download might fail sometimes, you may want to retry it for a few more times.
25 }
26 \examples{\dontshow{if (interactive()) \{}
27 # read the GitHub releases info of the repo yihui/xfun
28 xfun::retry(xfun::github_releases, "yihui/xfun")
29 \dontshow{\}}
30 }