
Detect whether a column holds participant age, gender/sex, or race/ethnicity
Source:R/data_check_helpers.R
data_check_demographic.RdA content-based classifier for the three demographic variables collected by
almost every human-subjects study. A column is tagged only when its NAME
looks like the demographic AND its VALUES are consistent with it (see
.demographic_values_ok), which keeps false positives low: a condition
column coded 1/2 is not flagged as gender, and an age column of free text
is not treated as usable age data.
Details
Complements data_col_type() (which gives a structural type such as
continuous/categorical): this adds a semantic label used by data_check
(reported in the column table) and data_validate (which reports the
demographics a file contains). Detection is name-driven, so a demographic
under a cryptic name (e.g. q3) is intentionally not caught here – that is
the LLM classifier's job.