r-quantities / units

Measurement units for R
https://r-quantities.github.io/units
175 stars 28 forks source link

Allow overriding of udunits #242

Closed hughjonesd closed 4 years ago

hughjonesd commented 4 years ago

I'd like to be able to e.g.

set_units(12, "pt" + set_units(1, "in")

and have pt interpreted as "big_point" not "pint". At the moment, I can install new symbols, but can't add symbols to or remove symbols from existing units.

Enchufa2 commented 4 years ago
remove_symbolic_unit("pt")
remove_symbolic_unit("t")
install_conversion_constant("in", "pt", 72)
set_units(12, "pt") + set_units(1, "in")
#> 84 [pt]

When you remove "pt", the pint, then udunits understands "pt" as "pico-tonnes", so you need to remove the tonne too.