Label Targets Table
label_targets.RdAdds human-readable labels for targets and categories to a summary table, using settings definitions and update mappings. Handles compound levels and range categories, and allows for custom/combined categories defined in settings$target_updates.
The function works as follows:
Parses the target string into target name and level (category).
Looks up human-readable labels for the target and for the category, using:
(a) The update_map, if provided and relevant for the target/level;
(b) The main settings (levels/label_levels);
(c) If the target is numeric, uses a helper for range-matching;
Returns the input data frame with columns "Target_Label" (target variable label) and "Category_Label" (category label or range).
Arguments
- df
Data frame or data.table. Must have a column "Target" with target/level strings.
- settings
List of settings, typically parsed from YAML, including elements
targetsandtarget_updates.- update_map
(Optional) List as built by
build_update_map. If NULL, will be built internally from settings.