Hi,
I just came across the following issue, in which the automatic unit conversion does not apply.
The reprex aims to rbind two data.frames which share the same column 'dt' of class 'units'. The unit however differs and the first one is used during rbind. Most probably this is rather a "rbind"-related issue but I thought it is worth sharing it here...
library(units)
#> udunits system database from /usr/local/share/udunits
# dummy data
h <- data.frame(dt = set_units(24, "h"))
min <- data.frame(dt = set_units(1440, "min"))
# binding both data.frames works, but silently gives wrong unit conversion results
# issue: first unit dominates the other
# ... here: hour
rbind(h, min)
#> dt
#> 1 24 [h]
#> 2 1440 [h]
# ... here: mins
rbind(min, h)
#> dt
#> 1 1440 [min]
#> 2 24 [min]
Hi, I just came across the following issue, in which the automatic unit conversion does not apply. The reprex aims to
rbind
two data.frames which share the same column 'dt' of class 'units'. The unit however differs and the first one is used duringrbind
. Most probably this is rather a "rbind"-related issue but I thought it is worth sharing it here...Created on 2020-03-24 by the reprex package (v0.3.0)