download: Download Documents

Description Usage Arguments Value Examples

View source: R/download.R

Description

This function enables downloading documents by wrapping curl::curl_download().

Usage

1
download(url, loc = tempdir(), file.out = NULL, ...)

Arguments

url

The download url(s).

loc

Where to put the files.

file.out

Option vector of names matching url. If this is not given download() will try to create a name from url.

...

Other arguments passed to curl::curl_download().

Value

Places a copy of the downloaded document in location specified and returns vector of the locations as string paths.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
m <- download(
c('https://cran.r-project.org/web/packages/curl/curl.pdf',
"https://github.com/trinker/textreadr/raw/master/inst/docs/rl10075oralhistoryst002.pdf"),
)

m

## End(Not run)

Example output

Error in curl::curl_download(url, out, ...) : 
  Could not resolve host: cran.r-project.org
Error in curl::curl_download(url, out, ...) : 
  Could not resolve host: github.com
[1] "Error in curl::curl_download(url, out, ...) : \n  Could not resolve host: cran.r-project.org\n"
[2] "Error in curl::curl_download(url, out, ...) : \n  Could not resolve host: github.com\n"        

textreadr documentation built on Oct. 9, 2021, 5:06 p.m.