View source: R/util_unit2baseunit.R
util_unit2baseunit | R Documentation |
Detect base unit from composite units
util_unit2baseunit(
unit,
warn_ambiguities = !exists("warn_ambiguities", .unit2baseunitenv),
unique = TRUE
)
unit |
character a unit |
warn_ambiguities |
logical warn about all ambiguous units |
unique |
logical choose the more |
character all possible or the preferable (unique set TRUE
)
base units. Can be character(0)
, if unit is invalid
or uniqueness was requested, but even using precedence
rules of SI
-closeness do not help selecting the most
suitable unit.
## Not run:
util_unit2baseunit("%")
util_unit2baseunit("d%")
# Invalid unit
util_unit2baseunit("aa%")
util_unit2baseunit("aa%", unique = FALSE)
util_unit2baseunit("a%")
# Invalid unit
util_unit2baseunit("e%")
util_unit2baseunit("e%", unique = FALSE)
util_unit2baseunit("E%")
util_unit2baseunit("Eg")
# Invalid unit
util_unit2baseunit("E")
util_unit2baseunit("E", unique = FALSE)
util_unit2baseunit("EC")
util_unit2baseunit("EK")
util_unit2baseunit("µg")
util_unit2baseunit("mg")
util_unit2baseunit("°C")
util_unit2baseunit("k°C")
util_unit2baseunit("kK")
util_unit2baseunit("nK")
# Ambiguous units, if used with unique = FALSE
util_unit2baseunit("kg")
util_unit2baseunit("cd")
util_unit2baseunit("Pa")
util_unit2baseunit("kat")
util_unit2baseunit("min")
# atto atom units or astronomical units, both in state "accepted"
util_unit2baseunit("au")
util_unit2baseunit("au", unique = FALSE)
# astronomical units or micro are, both in state "accepted"
util_unit2baseunit("ua")
util_unit2baseunit("ua", unique = FALSE)
util_unit2baseunit("kt")
# parts per trillion or pico US_liquid_pint, both in state "common",
# but in this case, plain count units will be preferred
util_unit2baseunit("ppt")
util_unit2baseunit("ppt", unique = FALSE)
util_unit2baseunit("ft")
util_unit2baseunit("yd")
util_unit2baseunit("pt")
# actually the same, but both only common, and to my knowledge not-so-common
# gram-force vs. kilogram-force (kilo pond)
util_unit2baseunit("kgf")
util_unit2baseunit("kgf", unique = FALSE)
util_unit2baseunit("at")
util_unit2baseunit("ph")
util_unit2baseunit("nt")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.