add_units: Add units to labels

View source: R/layout_helpers.r

add_unitsR Documentation

Add units to labels

Description

add_units adds units to variable labels from a named vector matching the names of the labels.

Usage

add_units(x, y)

Arguments

x

contains variable labels.

y

contains units to be added, matched by name.

Value

Named vector with labels and added units, if available (otherwise "NA" is added).

See Also

Other table layout: add_colgroup(), add_cols(), add_rowgroup(), firstrow_css(), layout_html(), order_by_vector(), order_layout(), prepare(), print_abbrev(), query_abbrev()

Examples

variable_labels <- c(
   'apples' = "Apples",
   'bnanas' = "Bananas",
   'peas' = "Peas"
)
unit_labels <- c(
   'apples' = "pcs",
   'peas' = "kg"
)
add_units(variable_labels, unit_labels)

eeenilsson/layout documentation built on Sept. 26, 2022, 8:14 p.m.