-
Notifications
You must be signed in to change notification settings - Fork 34
Description
This may be related to #249 or #292.
I'm working with fitting data on the log scale that simplifies to the below evaluation. There are three underlying issues here that may be better treated separately. (If you'd prefer them opened as separate issues, I'm happy to do so.)
Issue 1 is that it seems odd that units would create a unit that it cannot recognize. I recognize that more is probably happening here, but if it were possible to simplify the units with log transforms as indicated by setting the units to "ln(g)" in the example below, it would work.
Issue 2 is that it can add the units but it cannot divide them. It would seem that even if units could not be recognized, if they are identical, you could end up with a unitless value, regardless.
Issue 3 is that when dividing log units by themselves, they do not cancel to be unitless.
x1 <- log(units::set_units(2, "g"))
x1 + x1
#> 1.386294 [ln(re 1 g)]
x1/x1
#> Warning: Could not parse expression: '`ln`(`re` * ^(1) * `g`)'. Returning as a
#> single symbolic unit()
#> Error: '`ln`(`re` * ^(1) * `g`)' is not a unit recognized by udunits or a user-defined unit
x2 <- x1
attr(x2, "units")$numerator <- "ln(g)"
x2 + x2
#> 1.386294 [ln(g)]
x2/x2
#> 1 [ln(g)/ln(g)]Created on 2022-03-09 by the reprex package (v2.0.1)