Simplifies a rule set set by applying different simplification methods. This is a convenience function that works in common cases. The following simplification methods are executed:

For more control, these methods can be called separately.

simplify_rules(.x, .values = list(...), ...)

Arguments

.x

validator object with the rules to be simplified.

.values

optional named list with values that will be substituted.

...

parameters that will be used to substitute values.

Examples

rules <- validator( x > 0
                  , if (x > 0) y == 1
                  , A %in% c("a1", "a2")
                  , if (A == "a1") y > 1
                  )

simplify_rules(rules)
#> Object of class 'validator' with 3 elements:
#>  V1      : x > 0
#>  .const_y: y == 1
#>  .const_A: A == "a2"