download_retry {recount} | R Documentation

## Retry multiple times to download a file

### Description

This function is based on the Bioconductor guidelines for querying data from the web at http://bioconductor.org/developers/how-to/web-query/. It will run download a set of `N.TRIES` times before giving up. We implemented this function to reduce the number of Bioconductor build errors due to the occassional errors from our data hosting server.

### Usage

    download_retry(url, destfile = basename(url), mode = "wb", N.TRIES = 3L, ...)

### Arguments

`url` | The URL to download. Passed to download.
`destfile` | The destination file. Defaults to the base name of the URL. Passed to download.
`mode` | Mode for writing the file. The default `wb` is used for binary files. This value is passed to download which passes it to download.file.
`N.TRIES` | The number of download attempts before giving up; default: 3. Should be an integer of length one with a value greater than 0.
`...` | Additional arguments passed to download.

### Value

An invisible integer code as specified in download.file.

### Examples

    ## Download the first files_info.tsv file (version 1)
    download_retry(
        recount_url$url[which(recount_url$file_name == "files_info.tsv")[1]]
    )

[Package recount version 1.20.0 Index]