Notes

EML

I’ve added a interface for custom units. You don’t have to mess around with additionalMetadata as it should be handled automatically. Just define the unit itself, like this 1:

  create_custom_unit(id = "metersSquaredPerHectare",
                     parentSI = "dimensionless",
                     unitType = "dimensionless",
                     multiplierToSI = "0.0001",
                     description = "Square meters per hectare")

and then use the id you give as the unit type in your unit.defs. create_custom_unit updates a custom_units list in the EMLConfig environment, which the eml or write_eml functions detect and use to write in the additional metadata. 2

If the custom unit is not defined and the session is interactive, EML will prompt for essential fields in the unit definition. Other optional fields are also described in the documentation.


  1. Note that I just use “dimensionless” as an illustration here, a the better choice might perhaps be to define an area/area unitType as @mbjones discusses in #12. (We’ll add support for OBOE semantics eventually, but that’s much more complex)

  2. This isn’t ideal, since the use of environments means the function has “side effects” and you could inadvertently include unit definitions you defined for some other reason in your EML file (if you didn’t do eml_reset_config() or start a fresh R session). That wouldn’t break anything technical, but would seem a bit strange to define units you didn’t use. The environment mechanism can be avoided by explicitly passing list of custom_units to the eml or eml_write functions.