Thin orchestrator: passes column names through three matching layers in descending confidence order (exact → fuzzy → keyword) and returns a structured result. Each layer is implemented as a separate internal helper so individual layers can be tested or extended independently.
Arguments
- raw_colnames
Character vector of column names from the raw dataset (after name normalisation).
- config
Config object returned by
load_config().- fuzzy_max_distance
Numeric. Maximum edit distance for fuzzy matching. Default
0.15.
Value
A named list:
- match_log
data.tablewith one row per matched column.- rename_vec
Named character vector
old -> canonicalfordata.table::setnames().- unmatched
Column names that fell through all three layers.
Examples
yml <- system.file("extdata", "variable_map.yml", package = "cuci")
cfg <- load_config(yml)
match_columns(c("kjonn", "alder", "unknown_col"), cfg)$match_log
#> raw_name canonical method confidence needs_review
#> <char> <char> <char> <char> <lgcl>
#> 1: kjonn kjonn exact high FALSE
#> 2: alder alder exact high FALSE
