Learn R Programming

ume (version 1.5.2)

.f_label: Internal helper: pretty label lookup

Description

Internal utility function to map a variable or column name to a more descriptive, human-readable label based on a lookup table.

The lookup table must contain two columns:

  • name_pattern – Regular expressions to match column names

  • name_substitute – Human-readable label returned when pattern matches

The function returns the first matching substitute label. If no pattern matches, the input colname is returned unchanged.

This function is not exported and is intended for use inside the ume package (e.g., for automatic axis labeling in plotting functions).

Usage

.f_label(colname, lookup = ume::nice_labels_dt)

Value

A character string: either the substitute label or the original colname if no pattern matches.

Arguments

colname

Character string. Column name to be matched.

lookup

A data.table or data.frame with columns name_pattern and name_substitute.

Details

Lookup Pretty Labels for Column Names (Internal)