Skip to contents

Construct a column rule

Usage

column_rule(
  name,
  dtype = NULL,
  required = TRUE,
  nullable = TRUE,
  null_threshold = 1,
  min_val = NULL,
  max_val = NULL,
  allowed_values = NULL,
  unique = FALSE,
  regex = NULL,
  custom = NULL
)

Arguments

name

Column name.

dtype

One of "numeric", "character"/"object", "datetime", or NULL.

required

Whether the column must be present.

nullable

Whether NA values are allowed.

null_threshold

Maximum allowed fraction of NA (0–1).

min_val, max_val

Numeric bounds (or NULL).

allowed_values

Vector of permitted values (or NULL).

unique

Logical; whether values must be unique.

regex

Regex pattern for string columns (or NULL).

custom

Optional function (column) -> logical(1).

Value

A column_rule list.