knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  eval = FALSE
)

Create attributes tables

The create_attributes_table() function allows editing of an attributes table, factor table, or custom units table in a Shiny environment.

Example:

create_attributes_table(NULL, NULL)

data <- read.csv("Test.csv")
create_attributes_table(data, NULL)

attributes_table <- EML::get_attributes(eml@dataset@dataTable[[i]]@attributeList)$attributes
create_attributes_table(NULL, attributes_table)

create_attributes_table(data, attributes_table)

Format custom units

The return_eml_units() function uses the udunits2 unit library to format an inputted unit into an EML unit form.

Example:

# The following all return the same data frame
return_eml_units("kilometersPerSquareSecond") # preferred input form
return_eml_units("Kilometers per seconds squared")
return_eml_units("km/s^2")
return_eml_units("km s-2")
return_eml_units("s-2 /     kilometers-1") # works but is not advised

Adding an ORCID to a creator

A complete data package requires that at minimum one creator includes an associated ORCID. The add_creator_id() function allows you to add an ORCID or reference ID to any creator in the EML.

Example:

eml_path <- file.path(system.file(package = "datamgmt"), "dummy_meta_full.xml")
eml <- EML::read_eml(eml_path_original)
add_creator_id(eml, orcid = "https://orcid.org/WWWW-XXXX-YYYY-ZZZZ")

eml <- eml %>%
           add_creator_id(surname = "high-stakes",
                          orcid = "https://orcid.org/0000-1234-5678-4321",
                          id = "henrietta")

#use references to add updated contact info to Henrietta's other roles
eml@dataset@contact[[1]] <- new("contact", reference = "henrietta")
eml@dataset@metadataProvider[[1]] <- new("metadataProvider", reference = "henrietta")

Quality assurance for data packages

The qa_package() function checks that the attributes in the EML match the values in the data.

Example:

qa_package(mn, pid, 
           readAllData = FALSE, 
           check_attributes = TRUE, 
           check_creators = FALSE, 
           check_access = FALSE)


NCEAS/datamgmt documentation built on June 5, 2023, 6:14 a.m.