This function generates a number with units that work well within data frames and tibbles and implement safety checks on numerical operations with numbers that have different units. To retrieve the numerical value without units, use iso_strip_units (works for single variables and data frames/tibbles) or simply as.numeric (for single variables). To retrieve the unit use iso_get_units. Note that to correctly combine data frames / tibbles that have values with units in them, use vec_rbind instead of rbind or bind_rows. vec_rbind will combine columns that have values with units if they have the same unit and otherwise convert to a simple number with a warning. The other functions will either fail or reduce the unit values to plain numbers with a cryptic warning message about not preserving attributes.

iso_double_with_units(x = double(), units = "undefined units")



the numeric values (single value or vector)


the units the numeric value is in, by default "undefined units" but this parameter should always be supplied when working with real data that has units

See also