Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

download_file

Try various methods to download a file


Description

Try all possible methods in download.file() (e.g., libcurl, curl, wget, and wininet) and see if any method can succeed. The reason to enumerate all methods is that sometimes the default method does not work, e.g., https://stat.ethz.ch/pipermail/r-devel/2016-June/072852.html.

Usage

download_file(url, output = url_filename(url), ...)

Arguments

url

The URL of the file.

output

Path to the output file. By default, it is determined by url_filename().

...

Other arguments to be passed to download.file() (except method).

Value

The integer code 0 for success, or an error if none of the methods work.

Note

To allow downloading large files, the timeout option in options() will be temporarily set to one hour (3600 seconds) inside this function when this option has the default value of 60 seconds. If you want a different timeout value, you may set it via options(timeout = N), where N is the number of seconds (not 60).


xfun

Miscellaneous Functions to Support Packages Maintained by 'Yihui Xie'

v0.22
MIT + file LICENSE
Authors
Yihui Xie [aut, cre, cph] (<https://orcid.org/0000-0003-0645-5666>), Wush Wu [ctb], Daijiang Li [ctb], Xianying Tan [ctb], Salim Brüggemann [ctb] (<https://orcid.org/0000-0002-5329-5987>), Christophe Dervieux [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.