Get the unit shortnames, symbols or names that are available for a given quantity. The available quantities and units are defined by the argument unitTable which defaults to RstoxData::StoxUnits

getUnitOptions(
  quantity,
  property = c("shortname", "symbol", "name"),
  unitTable = RstoxData::StoxUnits,
  conversionRange = NULL
)

Arguments

quantity

quantity to get units for, such as 'mass', 'length' etc.

property

the property of the unit that is to be returned (e.g. 'symbol' or 'shortname')

unitTable

formatted as StoxUnits

conversionRange

pair of numeric values providing the lower and upper bound of which values for unitTable$conversion should be provided

Value

a character vector with available unit symbols.

Examples

 print(getUnitOptions("mass"))
#> [1] "g"       "kg"      "ton"     "kiloton" "megaton"
 print(getUnitOptions("mass", conversionRange=c(1e-3,1e3)))
#> [1] "g"   "kg"  "ton"