
Match data columns against codebook variable definitions (rules only)
Source:R/data_check_helpers.R
match_column_labels.RdFor each column in columns_df, find codebook variables whose normalised
name matches, respecting experiment-group scoping. Resolves multiple
definitions by haven priority, then rule-based label-equivalence
(normalize_label); genuinely differing labels are flagged
conflicting_definition. The LLM tiers (fuzzy matching, semantic merge) are
applied separately by codebook_check when llm_use(TRUE).
Arguments
- columns_df
data columns to label (needs
paper_id,source_file,column_name; optionalgroup/experiment_group)- codebook_vars_df
parsed codebook variables (from
parse_codebook())
Value
a data.frame with one row per input column: paper_id,
source_file, column_name, group, label, codebook_variable,
label_source, label_status, label_method.
Examples
cb <- parse_codebook(file.path(demofile("repo"), "documentation",
"stroop_data_codebook.csv"))
cols <- data.frame(paper_id = "stroop_effect", source_file = "stroop_data.csv",
column_name = c("congruent", "incongruent"))
match_column_labels(cols, cb)[, c("column_name", "label")]
#> column_name
#> 1 congruent
#> 2 incongruent
#> label
#> 1 Reaction time (in seconds) to name all words in the congruent block of the Stroop task
#> 2 Reaction time (in seconds) to name all words in the incongruent block of the Stroop task