Transform a variable name into a human-readable label, preserving acronyms
Source:R/helpers.R
transform_var_name.Rd
This function applies explicit mappings, strips numeric-range suffixes, removes time-prefixes and z-suffixes, replaces underscores, and converts to title case while preserving NZ, SDO, and RWA acronyms.
Usage
transform_var_name(
var_name,
label_mapping = NULL,
remove_tx_prefix = TRUE,
remove_z_suffix = TRUE,
use_title_case = TRUE,
remove_underscores = TRUE
)
Arguments
- var_name
Character; the original variable name
- label_mapping
Optional named list for explicit mappings
- remove_tx_prefix
Logical; remove leading 't0_' etc.
- remove_z_suffix
Logical; remove trailing '_z'
- use_title_case
Logical; convert to title case
- remove_underscores
Logical; replace underscores with spaces