compute_group_value_map: Build a raw-value -> canonical-label map for a grouping...

View source: R/grouping_utils.R

compute_group_value_mapR Documentation

Build a raw-value -> canonical-label map for a grouping column

Description

Real-world grouping columns are often messy: "female"/"Female"/ "FEMALE" in the same column, meant to be one group, not three. Builds a raw-value -> canonical-label mapping (one row per distinct raw value) that the Import tab's "Merge / relabel values" table starts from and the user can further edit by hand.

Usage

compute_group_value_map(raw_values, merge_case = TRUE)

Arguments

raw_values

The full grouping column, with repeats – frequency matters, since the most common casing/spacing variant becomes each cluster's canonical label (ties broken by whichever appears first).

merge_case

Logical; if TRUE (the default), values identical after trimws()+tolower() collapse into one label; if FALSE, every distinct raw value keeps its own label.

Value

A tibble with columns raw (every distinct input value) and label (its canonical label).

Examples

compute_group_value_map(c("female", "Female", "male"))

forecastsuite documentation built on Oct. 18, 2026, 5:08 p.m.