substitute_values | R Documentation |
Substitute values into expression, thereby simplifying the rule set. Rules that evaluate to TRUE because of the substitution are removed.
substitute_values(.x, .values = list(...), ..., .add_constraints = TRUE)
.x |
|
.values |
(optional) named list with values for variables to substitute |
... |
alternative way of supplying values for variables (see examples). |
.add_constraints |
|
library(validate)
rules <- validator( rule1 = z > 1
, rule2 = y > z
)
# rule1 is dropped, since it always is true
substitute_values(rules, list(z=2))
# you can also supply the values as separate parameters
substitute_values(rules, z = 2)
# you can choose to not add substituted values as a constraint
substitute_values(rules, z = 2, .add_constraints = FALSE)
rules <- validator( rule1 = if (gender == "male") age >= 18 )
substitute_values(rules, gender="male")
substitute_values(rules, gender="female")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.