Title: | Easily Download Data and Metadata from 'DataONE' |
---|---|
Description: | A set of tools to foster the development of reproducible analytical workflow by simplifying the download of data and metadata from 'DataONE' (<https://www.dataone.org>) and easily importing this information into R. |
Authors: | Julien Brun [cre, aut] , Irene Steves [aut] (<https://orcid.org/0000-0002-5511-9717>, https://github.com/isteves), Mitchell Maier [aut] , Kristen Peach [aut] , Nicholas Lyon [aut] (<https://orcid.org/0000-0003-3905-1078>, https://njlyon0.github.io/), Nathan Hwangbo [ctb] , Derek Strong [ctb] , Colin Smith [ctb] , Regents of the University of California [cph] |
Maintainer: | Julien Brun <[email protected]> |
License: | Apache License (== 2.0) |
Version: | 0.3.1.9000 |
Built: | 2024-10-31 19:47:06 UTC |
Source: | https://github.com/NCEAS/metajam |
This function takes an identifier and checks to see if it has been obsoleted.
check_version(pid, formatType = NULL)
check_version(pid, formatType = NULL)
pid |
(character) The persistent identifier of a data, metadata, or resource map object on a DataONE member node. |
formatType |
(character) Optional. The format type to return (one of 'data', 'metadata', or 'resource'). |
(data.frame) A data frame of object version PIDs and related information.
## Not run: # Most data URLs and identifiers work check_version("https://cn.dataone.org/cn/v2/resolve/urn:uuid:a2834e3e-f453-4c2b-8343-99477662b570") check_version("doi:10.18739/A2ZF6M") # Specify a formatType (data, metadata, or resource) check_version("doi:10.18739/A2ZF6M", formatType = "metadata") # Returns a warning if the identifier has been obsoleted check_version("doi:10.18739/A2HF7Z", formatType = "metadata") # Returns an error if no matching identifiers are found check_version("a_test_pid") # Returns a warning if several identifiers are returned check_version("10.18739/A2057CR99") ## End(Not run)
## Not run: # Most data URLs and identifiers work check_version("https://cn.dataone.org/cn/v2/resolve/urn:uuid:a2834e3e-f453-4c2b-8343-99477662b570") check_version("doi:10.18739/A2ZF6M") # Specify a formatType (data, metadata, or resource) check_version("doi:10.18739/A2ZF6M", formatType = "metadata") # Returns a warning if the identifier has been obsoleted check_version("doi:10.18739/A2HF7Z", formatType = "metadata") # Returns an error if no matching identifiers are found check_version("a_test_pid") # Returns a warning if several identifiers are returned check_version("10.18739/A2057CR99") ## End(Not run)
Downloads a data object from DataONE along with metadata.
download_d1_data(data_url, path)
download_d1_data(data_url, path)
data_url |
(character) An identifier or URL for a DataONE object to download. |
path |
(character) Path to a directory to download data to. |
(character) Path where data is downloaded to.
[read_d1_files()] [download_d1_data_pkg()]
## Not run: download_d1_data("urn:uuid:a2834e3e-f453-4c2b-8343-99477662b570", path = file.path(".")) download_d1_data( "https://cn.dataone.org/cn/v2/resolve/urn:uuid:a2834e3e-f453-4c2b-8343-99477662b570", path = file.path(".") ) ## End(Not run)
## Not run: download_d1_data("urn:uuid:a2834e3e-f453-4c2b-8343-99477662b570", path = file.path(".")) download_d1_data( "https://cn.dataone.org/cn/v2/resolve/urn:uuid:a2834e3e-f453-4c2b-8343-99477662b570", path = file.path(".") ) ## End(Not run)
Downloads all the data objects of a data package from DataONE along with metadata.
download_d1_data_pkg(meta_obj, path)
download_d1_data_pkg(meta_obj, path)
meta_obj |
(character) A DOI or metadata object PID for a DataONE package to download. |
path |
(character) Path to a directory to download data to. |
(list) Paths where data are downloaded to.
[read_d1_files()] [download_d1_data()]
## Not run: download_d1_data_pkg("doi:10.18739/A2028W", ".") download_d1_data_pkg("https://doi.org/10.18739/A2028W", ".") ## End(Not run)
## Not run: download_d1_data_pkg("doi:10.18739/A2028W", ".") download_d1_data_pkg("https://doi.org/10.18739/A2028W", ".") ## End(Not run)
Reads data along with metadata into your R environment based on [download_d1_data()] file structure.
read_d1_files(folder_path, fnc = "read_csv", ...)
read_d1_files(folder_path, fnc = "read_csv", ...)
folder_path |
(character) Path to a directory where data and metadata are located. |
fnc |
(character) Function to be used to read the data (default is [readr::read_csv()]). |
... |
Parameters to pass into the function specified in 'fnc'. |
(list) Named list containing data and metadata as data frames.
[download_d1_data()] [download_d1_data_pkg()]
data_folder <- system.file(file.path("extdata", "test_data"), package = "metajam") soil_moist_data <- read_d1_files(data_folder) # You can specify the function you would like to use to read the file and pass parameters soil_moist_data_skipped <- read_d1_files(data_folder, "read.csv", skip = 8, stringsAsFactors = FALSE)
data_folder <- system.file(file.path("extdata", "test_data"), package = "metajam") soil_moist_data <- read_d1_files(data_folder) # You can specify the function you would like to use to read the file and pass parameters soil_moist_data_skipped <- read_d1_files(data_folder, "read.csv", skip = 8, stringsAsFactors = FALSE)
This function takes a path to an EML (.xml) metadata file and returns a data frame.
tabularize_eml(eml, full = FALSE)
tabularize_eml(eml, full = FALSE)
eml |
An emld class object, the path to an EML (.xml) metadata file, or a raw EML object. |
full |
(logical) Returns the most commonly used metadata fields by default.
If |
(data.frame) A data frame of selected EML values.
eml <- system.file("extdata", "test_data", "SoilMois2012_2017__full_metadata.xml", package = "metajam") tabularize_eml(eml)
eml <- system.file("extdata", "test_data", "SoilMois2012_2017__full_metadata.xml", package = "metajam") tabularize_eml(eml)