powered by
Helper function to apply a function to a units object and then restore the original units.
units
keep_units(FUN, x, ..., unit = units(x))
An object of class units.
the function to be applied.
first argument of FUN, of class units.
FUN
optional arguments to FUN.
symbolic unit to restore after FUN.
Provided for incompatible functions that do not preserve units. The user is responsible for ensuring the correctness of the output.
x <- set_units(1:5, m) keep_units(drop_units, x)
Run the code above in your browser using DataLab