Skip to contents

Compares the columns of a data frame against a parsed official dictionary. This function does not mutate the data; it returns an auditable validation table.

Usage

enemdu_validate_data_against_official_dictionary(
  data,
  dictionary,
  required_vars = NULL,
  check_all_dictionary_vars = FALSE,
  missing_dictionary_as_error = FALSE,
  allow_extra = TRUE
)

Arguments

data

A data frame to validate.

dictionary

Official dictionary tibble produced by enemdu_read_official_dictionary_file() or an equivalent tibble with a variable column.

required_vars

Optional character vector of variables that must exist in data.

check_all_dictionary_vars

Logical. If TRUE, every dictionary variable missing from data is flagged.

missing_dictionary_as_error

Logical. If TRUE, missing dictionary variables are severity "error" when check_all_dictionary_vars = TRUE.

allow_extra

Logical. If FALSE, columns in data absent from the dictionary are marked as warning-level issues.

Value

A tibble with validation status by variable.