quantity_units | R Documentation |
Work with quantity units.
get_qty_units(q)
get_qty_units_with_label(q, label = names(q))
q |
quantities |
label |
text label to use with the units - single value or vector of the same length as |
get_qty_units()
: get units from a quantity, list of quantities or data frame (returns NA for objects/columns that are not quantities)
get_qty_units_with_label()
: get units from a quantity, list of quantities or data frame, with a custom label in the format label [units]
. Objects/columns that are not quantities simply return the label with out the [units] part.
Other quantity functions:
check_quantities
,
make_qty_units_explicit()
,
metric_scaling
,
quantities
,
quantity_data
# quantity units examples
qty(5000, "g") %>% get_qty_units()
x <- list(a = qty(5000, "g"), b = 42, c = qty(100, "mbar"))
x %>% get_qty_units()
# labels with units
get_qty_units_with_label(qty(0.1, "mM"), "concentration")
# make labels with units for data frame columns
x <- data.frame(a = qty(1, "mg"), b = 2, c = qty(100, "mbar"))
get_qty_units_with_label(x)
get_qty_units_with_label(x, "same label")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.