Skip to contents

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).

Usage

register_operator(name, fn, description = NULL)

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). x is the column values vector; value is the check parameter from the YAML rule. Return a logical vector of the same length as x where TRUE indicates a violation.

description

Optional character string describing what the operator checks. Used by rule_catalog() to document custom operators.

Value

Invisible NULL.

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"
)