This function retrieves a text representation of the units of a units/chemunits object. To get the symbolic units, use units::units() instead.
Usage
get_units(x, prefix = group[1], suffix = group[2], group = c("", ""))Arguments
- x
a chemunits vector
- prefix
the prefix text for the units. Default:
""(no prefix).- suffix
the suffix text for the units. Default:
""(no suffix).- group
parameter to specific the prefix and suffix text as a vector of length 2. This is helpful when using .e.g the prefix/suffix from the
units::units_options()groupfor this:group = units_options("group").
Examples
set_cu(1, "m/s") |> get_units()
#> [1] "m/s"
set_cu(1, "m/s") |> get_units(prefix = "(", suffix = ")")
#> [1] "(m/s)"
set_cu(1, "m/s") |> get_units(group = units_options("group"))
#> [1] "[m/s]"