-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Related to r-quantities/units#134 (and others)
I'm not sure how to best discuss this. In the end, I don't think that it will be part of the units library, but I would like to engage both @Enchufa2, @edzer, and others to get this solution right. I hope that you think it's okay to have (or at least start) the discussion here.
The issue of units that are often not convertible often comes up as evidenced in r-quantities/units#134 and several other issues linking there. It signals a need to have a method of keeping different unit conversions separated. A typical example is mass-to-moles conversions that happen in many fields. For the data I work with (often laboratory measurements of blood tests), other types of conversions can exist like activity to molar conversions (e.g. conversion of 1 mole per hour of X is means that the concentration of Y is Z moles/L).
To accomplish this, I think that the best method would be the creation of a new package that would enable the following:
- Keep different analytes separate
- For example, "carbon dioxide" is different than "carbon" (quotes are used here and for the rest of this comment to indicate an analyte)
- Allow conversion between different measurement types of the same analyte
- For example, 1 mole of "carbon dioxide" is the same as 44.01 grams of "carbon dioxide"
- Prevent conversion between analytes, unless there is a specific addition of a conversion
- For example, "carbon dioxide" cannot be converted to "carbon" unless there is a specific conversion factor added
- It is possible to convert between analytes, when the conversion is specifically added
- For example, 1 mole of "carbon dioxide" is equal to 1 mole of "carbon"
- Multiple different sets of conversions can be used within one R session
- For example, one conversion system may only allow conversion between units for "carbon dioxide" and another may allow conversion between "carbon" and "carbon dioxide" as well because they may both be used for different purposes during one session.
- Conversions may be more complex than multiplication or division and may use a function instead of a multiplication factor
- For example, the laboratory measurement of HbA1c (a measurement used to detect diabetes) recently had a conversion created with an offset and conversion factor between units of "percent of hemoglobin that is glycated" to "mmol glycated hemoglobin/total mol hemoglobin" (editorial note, yes, those seem like they would be converted by multiplication or division, only, but they are not based on standards defined by international bodies-- I think because they are actually measured a little differently in the machine).
Are there other features that should be supported?