Skip to contents

A wrapper around units::set_units() mostly to have a short name to create a dimensionful quantity.

Usage

u(x, unit = "1")

Arguments

x

A numeric vector to be augmented with a unit.

unit

A character indicating the unit. See units::valid_udunits() and units::valid_udunits_prefixes() for possible units.

Examples

u(10, "km") # 10 kilometer
#> 10 [km]
u(10, "mm") # 10 mm
#> 10 [mm]

# comparison taking into account the unit
u(100, "m") > u(1, "km")
#> [1] FALSE