
Apply dataset-specific value corrections before cleaning
Source:R/value_corrections.R
apply_value_corrections.RdRewrites cell values in named columns using a small pattern/replacement table. This is the escape hatch for dataset quirks the reference lists cannot express: a "Total " prefix on every analyte, a known-bad CAS, a unit typo. Runs before the cleaning pipeline so every downstream step sees the corrected value.
Arguments
- df
Data frame after frontmatter extraction and
janitor::clean_names().- value_corrections
Data frame with columns
column,pattern,replacement, and optionalmatch_mode(one of"regex"(default),"literal_exact", or"literal_word"). Rows are applied in order.