Find the unit identifier given quantity and either symbol, shortname or name
findUnit(
quantity,
shortname = NULL,
symbol = NULL,
name = NULL,
unitTable = RstoxData::StoxUnits
)
The quantity to look up units for
shortname of the desired unit
Symbol of the desired unit
name of the desired unit
formatted as StoxUnits
valid id in unitTable
This is useful for looking up correct unit identifiers from user input. Provide either symbol, shortname or name, do not provide more than one.
The argument 'conversionTable' defines valid units and their symbols.
This defaults to StoxUnits
.
getUnitOptions
for listing all valid options for a quantity.
findUnit("mass", getUnitOptions("mass")[1])
#> [1] "mass-mcg"
findUnit("length", "m")
#> [1] "length-m"