File: retry.Rd

package info (click to toggle)
r-cran-xfun 0.37%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 792 kB
  • sloc: ansic: 242; sh: 22; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 951 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{retry}
\alias{retry}
\title{Retry calling a function for a number of times}
\usage{
retry(fun, ..., .times = 3, .pause = 5)
}
\arguments{
\item{fun}{A function.}

\item{...}{Arguments to be passed to the function.}

\item{.times}{The number of times.}

\item{.pause}{The number of seconds to wait before the next attempt.}
}
\description{
If the function returns an error, retry it for the specified number of
times, with a pause between attempts.
}
\details{
One application of this function is to download a web resource. Since the
download might fail sometimes, you may want to retry it for a few more times.
}
\examples{\dontshow{if (interactive()) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf}
# read the Github releases info of the repo yihui/xfun
xfun::retry(xfun::github_releases, "yihui/xfun")
\dontshow{\}) # examplesIf}
}