View source: R/get_from_zenodo.R
get_from_zenodo | R Documentation |
get_from_zenodo()
allows you to easy download a Zenodo record or
a Zenodo file.
This function only works for Zenodo created DOIs (not when the DOI is, for example, derived from Zookeys).
get_from_zenodo(doi, path = ".", file = NULL, parallel = FALSE)
doi |
A string indicating a Zenodo DOI (Digital Object Identifier)
starting with |
path |
(optional) a string indicating a directory path where the data
must be downloaded (default: |
file |
(optional) a |
parallel |
(optional) a |
This function requires an internet connection and the
curl
,
jsonlite
,
parallel
, and
tools
packages to work.
If you don't have any or one of the packages mentioned above, you can install
them with install.packages("curl", "jsonlite", "parallel", "tools")
.
You can find more about the Zenodo API at https://developers.zenodo.org/.
get_from_zenodo()
code is based on the download_zenodo()
function found
in the inborutils
package of the
Research Institute for Nature and Forest (INBO).
download_zenodo()
was created by Hans Van Calster (hans.vancalster@inbo.be)
and Floris Vanderhaeghe (floris.vanderhaeghe@inbo.be).
We give our thanks for the INBO institute and for all developers involved in this piece of software.
Please note that this code comes with an MIT License. You can read the latter below.
Copyright (c) 2016 Instituut voor Natuur en Bosonderzoek (INBO) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
A character
object with the paths for all the files
downloaded.
Other API functions:
get_sun_stats()
## Not run:
## Downloading a single file from a Zenodo record
path <- tempdir()
file <- "sleep-diary.txt"
get_from_zenodo(
doi = "10.5281/zenodo.4898822", path = path, file = file
)
readLines(file.path(path, file))
## Downloading all the files from a Zenodo record
get_from_zenodo(
doi = "10.5281/zenodo.4898822", path = tempdir(), file = NULL
)
## Downloading all the files from a Zenodo record using parallel
## computation
get_from_zenodo(
doi = "10.5281/zenodo.4898822", path = tempdir(), file = NULL,
parallel = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.