validate
validate copied to clipboard
Consequence of passing a rule
Im looking for an efficient way of replacing a column value if a rule passes:
df <- data.frame(A = 1:3, B = 1:3)
rules <- data.frame(name = "Rule 1", rule = "A == '1' & B == '1'", description = "")
rules <- validator(.data = rules)
satisfying(df, rules)
I looked into other packages, but I like the syntax of validate
a lot. In the more complex application I will have dozens of rules where a value of a clumn will have to be corrected if the rule passes (or fails). It would be nice to have something like
df <- data.frame(A = 1:3, B = 1:3)
rules <- data.frame(name = "Rule 1", rule = "A == '1' & B == '1'", description = "", consequence = "A = 99")
rules <- validator(.data = rules)
conclude(df, rules)
which would return the input data.frame with applied consequences.