This function is intended for data frames / tibbles only and makes the specified columns explicit with the target units in the column name.
make_qty_units_explicit(df, ..., prefix = " [", suffix = "]")
df | the data frame in which to make the units explicit |
---|---|
... | named arguments for the columns that should be made explicit and their units, e.g. |
prefix | the prefix for the units |
suffix | the suffix for the units |
Other quantity functions:
check_quantities
,
metric_scaling
,
quantities
,
quantity_data
,
quantity_units
#> # A tibble: 5 x 2 #> x y #> <m[mg]> <V[L]> #> 1 1 1 #> 2 2 2 #> 3 3 3 #> 4 4 4 #> 5 5 5# show with explicit units make_qty_units_explicit(df, x = "mg")#> # A tibble: 5 x 2 #> `x [mg]` y #> <dbl> <V[L]> #> 1 1 1 #> 2 2 2 #> 3 3 3 #> 4 4 4 #> 5 5 5make_qty_units_explicit(df, x = "g", y = "mL")#> # A tibble: 5 x 2 #> `x [g]` `y [mL]` #> <dbl> <dbl> #> 1 0.001 1000 #> 2 0.002 2000 #> 3 0.003 3000 #> 4 0.004 4000 #> 5 0.005 5000