Closed billdenney closed 1 year ago
We have
> units::set_units(1, "m") < units::set_units(NA, "m")
[1] NA
I don't see why NA
should be treated differently from a regular numeric
.
My rationale for asking is that in some of my code in the PKNCA package, I use NA
as an indicator of missingness. I'm working through the package to make it units
-enabled while trying to keep the code as generalized as reasonable. For that, I'm trying to only use units
-specific code where required.
What I'm doing right now is I'm adding more code to test for NA
first and then do the comparison if the value is not NA
. It would be simpler to be able to do the boolean operator comparison directly since it will always result in NA
.
That said, I can add the separate NA test first throughout the code, if this is not a feature of interest.
All binary comparisons and arithmetic operators (e.g.
<
,>
,+
,*
, etc.) when performed with anNA
value result inNA
. It would be helpful if the Ops with units allowed NA values to have these comparisons by default.Created on 2022-03-09 by the reprex package (v2.0.1)