Translates each spec variable's free-text derivation into a variable IR using the selected backend: `"rules"` runs the built-in deterministic, zero-dependency keyword classifier (baseline and fallback); `"llm"` runs the structured-extraction pipeline via [classify_variables_llm()] (requires an ellmer `chat`).
Arguments
- spec
Spec data frame compatible with [read_spec_df()].
- dataset
Dataset name to classify (e.g. `"ADSL"`).
- backend
One of `"rules"` or `"llm"`.
- chat
ellmer chat object; required when `backend = "llm"`, ignored otherwise.
- samples
Number of independent LLM pipeline runs; used when `backend = "llm"`, ignored otherwise. See [classify_variables_llm()].
- consensus
Voting strategy across samples; used when `backend = "llm"`, ignored otherwise. See [classify_variables_llm()].
- prompt_variant
System prompt variant; used when `backend = "llm"`, ignored otherwise. See [classify_variables_llm()].
Examples
spec <- mock_spec_adsl()
ir <- classify_variables(spec, "ADSL", backend = "rules")
ir[[1]]$variable
#> [1] "STUDYID"