Helper function to apply a function to a units
object and then restore
the original units.
Usage
keep_units(FUN, x, ..., unit = units(x))
Details
Provided for incompatible functions that do not preserve units. The user is responsible for ensuring the correctness of the output.
Examples
x <- set_units(1:5, m)
keep_units(drop_units, x)
#> Units: [m]
#> [1] 1 2 3 4 5