Maps a CORE operator name (e.g., "shorter_than") to an R function.
The function receives (column_values, check_value) and returns a
logical vector (TRUE = violation found).
Arguments
- name
Character string. The CORE operator name used in YAML rules (e.g.,
operator: starts_with).- fn
A function with signature
function(x, value).xis the column values vector;valueis the check parameter from the YAML rule. Return a logical vector of the same length asxwhereTRUEindicates a violation.- description
Optional character string describing what the operator checks. Used by
rule_catalog()to document custom operators.
See also
Other conformance:
adam_rules(),
build_anchor_index(),
clear_ct(),
fda_rules(),
fetch_core_rules(),
fetch_herald_rules(),
herald_rules_cache_dir(),
list_ct(),
load_herald_config(),
new_herald_context(),
pmda_rules(),
register_ct(),
rule_catalog(),
rule_config(),
update_core_rules(),
validate(),
validate_spec(),
validate_spec_define(),
validation_report(),
verify_html_report()
Examples
register_operator(
name = "starts_with",
fn = function(x, value) !startsWith(as.character(x), value),
description = "Checks that column values start with the given prefix"
)
