Validates that no element of the value occurs in the vector a formula
evaluates to, for example that train and test ids do not overlap. The
formula is evaluated using only explicitly passed context arguments, plus
.value and .name.
Usage
require_disjoint(restriction, formula)
Arguments
- restriction
a restriction object.
- formula
a one-sided formula (e.g. ~ test_ids).
Value
The modified restriction object.
Details
NA elements are ignored. A factor is compared by its labels.
Examples
train_ids <- restrict("train_ids") |> require_disjoint(~ test_ids)
train_ids(1:3, test_ids = 4:6)
try(train_ids(1:3, test_ids = 3:6))
#> Error : train_ids: must not share values with test_ids
#> Found: "3"
#> At: 3