zenodoArchive
zenodoArchive
Object of R6Class
for modelling an zenodoArchive for ASC cluster files
R6Class
object.
doi
zenodoArchive doi, NULL is not supplied
all_versions
zenodoArchive if to return all versions, true
when not specified
sort
zenodoArchive how to sort the records, mostrecent
when not specified
page
zenodoArchive which page to pull in query, 1
when not specified
size
zenodoArchive how many records per page, 20
when not specified
zenodoVersions
zenodoArchive doi available version, a storing variable.
zenodoQuery
zenodoArchive doi version query, a storing variable.
download_file
zenodoArchive doi downloads files, a storing variable.
download_url
zenodoArchive doi downloads urls, a storing variable.
new()
initializes the zenodoArchive
zenodoArchive$new(
doi,
page = 1,
size = 20,
all_versions = "true",
sort = "mostrecent"
)
doi
A zenodo doi. To retrieve all records supply a concept doi (a generic doi common to all versions).
page
Which page to query. Default is 1
size
How many records per page. Default is 20
all_versions
If to return all concept doi versions. If true
returns all, if false
returns the latest. Default is ture
sort
Which sorting to apply on the records. Default is mostrecent
. Possible sortings "bestmatch", "mostrecent", "-mostrecent" (ascending), "version", "-version" (ascending).
clean_doi()
cleans the doi record for query
zenodoArchive$clean_doi(doi = self$doi)
doi
The zenodo archive doi
the clean doi
zenodo_query()
Query the zenodo archive according to the initial parameters.
zenodoArchive$zenodo_query(...)
...
Excepts the self created by initialize
a list with the query values.
get_versions()
Extract all concept doi available versions.
zenodoArchive$get_versions(...)
...
Excepts the self created by initialize
a data.frame of the available versions.
get_version_files()
get the chosen doi archive version available files
zenodoArchive$get_version_files(version = "latest")
version
which archive version files to get. Default to latest. To see all available version use get_versions
a list of the available files in the archive version.
download_zenodo_files()
get the chosen doi archive version available files
zenodoArchive$download_zenodo_files(
file = NULL,
path = tempdir(),
version = "latest",
all_files = F,
get_file_path = F,
quite = F
)
file
If supplied, downloads the specific file from the archive.
path
The output folder for saving the archive files. Default is to a temporary directory.
version
which archive version files to get. Default to latest. To see all available version use get_versions
all_files
Logical (FALSE by default). Do you want to download all files in the archive.
get_file_path
Logical (FALSE by default). Do you want to return the path for the file downloaded.
quite
Logical (FALSE by default). Do you want to suppress informative messages
If get_file_path
is TRUE, the function returns the path to the archive file
clone()
The objects of this class are cloneable with this method.
zenodoArchive$clone(deep = FALSE)
deep
Whether to make a deep clone.
# \donttest{
zenodo_archive <- zenodoArchive$new(
doi = "10.5281/zenodo.7401189"
)
# view available version ins the archive
archive_versions <- zenodo_archive$get_versions()
# Getting the available files in the latest zenodo archive version
files <- zenodo_archive$get_version_files()
# downloading the first file from the latest archive version
zenodo_archive$download_zenodo_files()
# }
Run the code above in your browser using DataLab