custom-units.Rmd
This document explains how to add custom units to a EML document. This document will not explain how to create a complete valid EML document to upload to the EDI repository. Please use this article just for the custom units section of the EML document and refer to the EML template helper to generate the entire document.
If you have units that are not included in the EML schema you can add custom units by adding the following code into your script. This example adds two custom units, “NTU”, and “psu”. You can add as many custom units as you want as long as you add them in the same format as shown below.
custom_units <- data.frame(id = c("NTU", "psu"),
unitType = c("dimensionless", "dimensionless"),
parentSI = c(NA, NA),
multiplierToSI = c(NA, NA),
description = c("Nephelometric Turbidity unit",
"used to describe the concentration of dissolved salts
in water, the UNESCO Practical Salinity Scale of 1978
(PSS78) defines salinity in terms of a conductivity
ratio"))
unitList <- EML::set_unitList(custom_units)
When defining custom units you must also add them into the eml list. To do this the unitList
created above is added in a nested list under the additionalMetadata
section as shown below.