Learn R Programming

DQA (version 0.1.0)

conformance_rules: Default Conformance Check Rules (Reference)

Description

The `DQA` package provides a suite of built-in rule functions for use with `conformance_check()`. You can use these rule names directly in the `Conformance_Rule` column of your metadata dataframe.

Arguments

General Purpose Rules

unique_check(x)

Checks for unique (non-duplicate) values.

character_check(x)

Checks for the presence of alphabetic characters.

email_check(x)

Checks if values are valid email addresses.

numeric_check(x)

Checks if values can be interpreted as numbers.

integer_check(x)

Checks if values are integers (whole numbers).

length_check(x, val_num)

Checks if string length matches the given value (from the `Value` column).

category_check(x, val_num, val_ops, val_lit)

Checks membership in allowed categories (numbers or literals).

set_check(x, val_lit)

Checks if value is in a user-defined set (from `Value`).

not_null_check(x)

Checks if value is not missing (`NA`).

Numeric/Date Rules

date_check(x, val_lit)

Checks if value is a valid date (optionally in specified format).

regex_check(x, val_lit)

Checks values against a user-supplied regular expression.

Computational

bmi_check(x, val_lit = NULL, val = NULL)

Checks a BMI column for consistency with the corresponding Weight and Height columns. Put your "Weight and Height" columns in the Value column in the metadata for calculation

The function reads the column names for weight and height dynamically from the val_lit argument, which is typically provided by the metadata (M_data) in the Value column as a comma- or pipe-separated string (for example, Weight,Height or Weight|Height; use the actual column names in your dataset).

The function automatically detects the unit for height (cm or m) based on the data, and allows for custom rounding digits and tolerance via the optional val argument (e.g., val = c(1, 0.01) for 1 decimal digit and 0.01 tolerance).

Returns a logical vector indicating which rows pass the BMI consistency check.

Notes

See the actual implementation of these functions in the package by obtaining a copy with `conformance_scaffold_rules()`.

Details

Most rules accept the column vector as `x`, and some accept extra parameters (e.g., `val_num`, `val_lit`) parsed from the `Value` column of your metadata.