Skip to contents

Thin wrapper around figshare_file_download() with host = "data.4tu.nl" – see the note at the top of this file. Creates a directory for the article and downloads all of its files. Returns (invisibly) a data frame with file info.

Usage

researchdata4tu_file_download(
  researchdata4tu_id,
  download_to,
  max_file_size = 10,
  max_download_size = 100,
  unzip_types = NULL,
  pb = NULL
)

Arguments

researchdata4tu_id

a 4TU.ResearchData article ID, uuid, URL, or DOI

download_to

path to download to; there is no default, because CRAN does not allow writing into the working directory unless you ask for it

max_file_size

maximum file size to download (in MB) - set to NULL or Inf for no restrictions

max_download_size

maximum total size to download - set to NULL or Inf for no restrictions

unzip_types

file categories to extract from .zip files in the article rather than downloading the zip whole, named as data_classify_files() names them: "data", "code", "materials", "documentation", "output", "unknown". More than one may be given. NULL (the default) downloads zips whole and leaves them zipped, as before. max_file_size applies to each extracted member rather than to the archive.

pb

a progress bar passed from another function

Value

data frame of file info. When members are extracted from a zip, its row reports the zip with extracted giving the number of members written; size_on_disk and checksum_ok are then NA, because what is on disk is the members rather than the archive 4TU.ResearchData published a size and MD5 for.

Details

Uses researchdata4tu_pat(), not figshare_pat(), for authentication (see that function's documentation for why the two are separate).

Examples

# \donttest{
if (online("data.4tu.nl")) {
  dl <- researchdata4tu_file_download("16766929",
                                      download_to = file.path(tempdir(), "4tu"),
                                      max_download_size = 10)
}
# }