Attaches (set_*) or retrieves (get_*) a "unit" attribute (e.g. "EUR",
"%", "persons") from/to a data matrix within a procr_table subtable.
The unit is purely descriptive metadata; it is not used in any calculation,
but can be displayed by downstream export/print functions (see to_gt()).
Usage
set_data_unit(tab, unit, ..., data = "main", subtable = NULL)
get_data_unit(tab, data = "main", subtable = NULL)Arguments
- tab
A
procr_tableobject.- unit
Character scalar giving the unit label, or
NULLto remove a previously set unit.- ...
Not used for values, forces later arguments to bind by name.
- data
Character scalar. Name of the data matrix to attach the unit to (e.g.
"main","se"). Defaults to"main".- subtable
Reference to the subtable within
tabcontainingdata. Can beNULL(default) if only one subtable exists, else either a character scalar reference to the subtable name or a numeric scalar reference to its position.
Value
set_* returns the modified procr_table object. get_* returns
the unit as a character scalar, or NULL if none is set.
See also
set_data_numfmt() and get_data_numfmt() to set/get number
formatting.