
Classify repository files into data_check semantic types
Source:R/data_check_helpers.R
data_classify_files.RdRules-only classifier used by the data_check module when the LLM is off.
Layers metacheck's file_category() (name-based readme/codebook/data/code
rules) over an extension crosswalk built on metacheck::file_types, then
applies format-locked extension overrides.
Arguments
- file_name
a character vector of file names (basenames)
- file_path
optional character vector, same length as
file_name: the full repo-relative path of each file (e.g."ResearchBox 801/Materials/ Informant Survey_Redacted.pdf"). When supplied, a keyword found ANYWHERE in the path (a folder segment OR the filename itself – see the Tier 2 keyword table below) reclassifies a file. A researcher's own naming, whether the folder or the file, is a stronger, more deliberate signal than a generic extension like.pdf/.docx/.txt, which could hold anything (a PDF questionnaire is materials; a PDF preprint is documentation; the extension alone cannot tell them apart, but the author's own naming can). Does NOT override a format-locked type (.fixed_ext_type, orfile_category()'s own hard rules): a genuine.csv/.R/.savfound under a mislabelled "Materials/" folder still classifies by its real format, since the extension is stronger evidence of what the file actually IS than a name is.NULL(the default) disables this layer entirely, unchanged from before.
Value
a character vector of data_check types (see .data_check_types);
"unknown" when no rule fires. See .data_doc_role() for the finer
readme/codebook/supplemental distinction within "documentation".
Examples
data_classify_files(c("data.csv", "analysis.R", "README.md", "codebook.xlsx"))
#> [1] "data" "code" "documentation" "documentation"