download_safe_files | R Documentation |
This downloads files associated with SAFE datasets, either all of the
files included in a set of records (xlsx_only = FALSE
) or just
the core .xlsx files (xlsx_only = FALSE
), and stores them in the
SAFE data directory. See insert_dataset
for details on
using embargoed or restricted datasets.
download_safe_files(
record_ids,
confirm = TRUE,
xlsx_only = TRUE,
download_metadata = TRUE,
refresh = FALSE,
token = NULL
)
record_ids |
A vector of SAFE dataset record ids or a
|
confirm |
Requires the user to confirm before download (logical) |
xlsx_only |
Should all files be downloaded or just the core .xslx file (logical) |
download_metadata |
Should the metadata record for the file be downloaded (logical) |
refresh |
Should the function check if local copies have been modified and download fresh copies. This is useful if the local copies have unintentionally been modified but note the warning above. |
token |
An access token for restricted datasets. These tokens are requested through the Zenodo page for a restricted dataset and are long alphanumeric strings. If you are providing a token, you should only provide the record id for that dataset. |
By default, the function will also download the dataset metadata. This information is required by many of the functions in the package but users can turn off automatic metadata download.
Invisibly, a vector of paths within the 'safe_dir' for successfully downloaded files. If the download is not successful then the function returns FALSE.
Using refresh = TRUE
will overwrite locally modified
files and replace them with the versions of record from Zenodo.
set_example_safe_dir()
recs <- validate_record_ids(c(3247631, 3266827, 3266821))
download_safe_files(recs, confirm = FALSE)
unset_example_safe_dir()
## Not run:
# This example requires a private token
download_safe_files(1237730, confirm = FALSE,
token="longStringFromZenodo")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.