Learn R Programming

rdryad (version 0.4.0)

dryad_fetch: Download Dryad files

Description

Download Dryad files

Usage

dryad_fetch(url, destfile = NULL, try_file_names = FALSE, ...)

Arguments

url

(character) One or more Dryad URL for a dataset

destfile

(character) Destination file. If not given, we assign a file name based on URL provided.

try_file_names

(logical) try to parse file names out of the URLs. Default: FALSE

...

Further args passed on to curl::curl_download()

Value

named (list) with path(s) to the file(s) - list names are the urls passed into the url parameter

Details

This function is a thin wrapper around curl::curl_download() to get files to your machine only. We don't attempt to read/parse them

Examples

Run this code
# NOT RUN {
# Single file
x <- dryad_files('10.5061/dryad.1758')

## without specifying a destination file
dryad_fetch(url = x)

## specify a destination file
dryad_fetch(url = x[1], (f <- tempfile(fileext = ".csv")))

## use try_file_names - we try to extract file names from URLs
dryad_fetch(url = x, try_file_names = TRUE)

# Many files
x <- dryad_files(doi = '10.5061/dryad.60699')
res <- dryad_fetch(x)
head(read.delim(res[[1]], sep = ";"))
# }

Run the code above in your browser using DataLab