r-quantities/units

Unitless options

Closed this issue · 1 comments

Hi all,

Thanks for all the work on this package! It's very useful to me for system dynamics modelling.

I was wondering whether it's possible to add two extensions:

  1. Allow mathematical operations between a unitless value and a value without units
set_units(1, "1") - 1
Error in Ops.units(set_units(1, "1"), 1) : 
  both operands of the expression should be "units" objects
  1. Set unitless to an arbitrary unit
set_units(set_units(1, "1"), "seconds")
Error: cannot convert 1 into s

Best,
Kyra Evers

Thanks for your suggestions.

  • About the first extension, we discussed this in the past, and we decided not to allow it. So it's a design decision. One of the reasons is related to the next question.
  • Unitless is, in some way, a unit, so it cannot be arbitrarily converted to anything. This comes from the underlying udunits library, and we are not going to circumvent that.