write_units: Create template yaml file(s) for supplying attribute unit...

View source: R/write_units.R

write_unitsR Documentation

Create template yaml file(s) for supplying attribute unit metadata

Description

write_units creates template yaml file(s) for supplying attribute QUDT and custom unit metadata for a data object that resides in the R environment.

Usage

write_units(entity_name, entity_id)

Arguments

entity_name

(character) Quoted name of the data object in the R environment

entity_id

(character) A string that uniquely identifies the object in the R environment (e.g., the hash of a table)

Details

write_units generates zero to two yaml template files based on the reference of attribute units associated with a data entity. A 'annotations.yaml' template is generated if attribute units are in the QUDT unit dictionary. A 'custom_units.yaml' template is generated for custom (i.e., not in the EML standard units or QUDT dictionaries) and/or QUDT units. In the case of custom units, entries include a description field for investigators to provide a description of the unit. In the case of QUDT units, only the name of the unit is included in 'custom_units.yaml' - QUDT metadata are documented in the <annotation> element but a reference to any units not in the EML standard unit list must be referenced in <additionalMetadata>. will be created if both QUDT and custom units are identified, and neither template will be written if the data entity does not have units or if all of the units are in the EML standard dictionary (because further documentation is not required). Unit metadata will be appended to templates if they already exist in the working directory.

Value

'annotations.yaml', 'custom_units.yaml', both, or neither depending on the unit reference (QUDT, custom, EML standard unit library) used to characterize attribute units for a data entity.

Note

write_units evalutes a data object's attributes metadata file (e.g., 'my_table_attrs.yaml'). As such, this file must exist in the working directory.

Examples

## Not run: 

 # create units metadata file(s) from the algae_attrs.yaml
 # file in the working directory

 algae <- read.csv("algae.csv")

 capeml::write_units(
   entity_name = "algae",
   entity_id   = tools::md5sum("algae.csv")
 )


## End(Not run)


CAPLTER/capeml documentation built on April 3, 2024, 11:17 p.m.