Skip to contents

Appends a typed rule, or replaces the rule with the same name (upsert). The payload arguments depend on type:

filter, check

column, op, values (structured) or expr (a predicate string). op in in, not_in, ==, !=, >, >=, <, <=, between, is_true, is_false.

subset

subset – a vector of entity ids to keep (captured).

label

map (an id-named vector) or from (a data frame) with keys and label column names; label also names the derived column.

select

vars, scope, tables, drop (resolved via field_concordance).

dedup

group, partial, amended, timestamp column overrides for deduplicate().

refresh

fn – a function taking and returning a data frame.

view

rows, cols, value, fun – a crosstab/tapply summary.

function

value/code (a string) or fn (a function).

Usage

add_rule(sfw, name = NULL, type, ...)

Arguments

sfw

A sample frame.

name

Rule name. Empty/NULL auto-generates <type>_<n>. An existing name replaces that rule.

type

One of the rule types above.

...

Type-specific payload (see Details).

Value

The updated sample frame.