|
1 | 1 |
|
2 | 2 | <!-- README.md is generated from README.Rmd. Please edit that file --> |
| 3 | + |
3 | 4 | <!-- badges: start --> |
4 | 5 |
|
5 | 6 | [](https://github.com/data-cleaning/validatetools/actions/workflows/R-CMD-check.yaml) |
6 | 7 | [](https://CRAN.R-project.org/package=validatetools) |
8 | | -[](https://codecov.io/github/data-cleaning/validatetools) |
9 | | -[](https://CRAN.R-project.org/package=validatetools) |
10 | 9 | [](http://www.awesomeofficialstatistics.org) |
| 11 | +[](https://app.codecov.io/gh/data-cleaning/validatetools) |
12 | 13 | <!-- badges: end --> |
13 | 14 |
|
14 | 15 | # validatetools |
15 | 16 |
|
16 | 17 | `validatetools` is a utility package for managing validation rule sets |
17 | 18 | that are defined with `validate`. In production systems validation rule |
18 | | -sets tend to grow organically and validatetools redundant or (partially) |
| 19 | +sets tend to grow organically and accumulate redundant or (partially) |
19 | 20 | contradictory rules. `validatetools` helps to identify problems with |
20 | 21 | large rule sets and includes simplification methods for resolving |
21 | 22 | issues. |
@@ -70,6 +71,27 @@ is_contradicted_by(rules, "rule1") |
70 | 71 | #> [1] "rule2" |
71 | 72 | ``` |
72 | 73 |
|
| 74 | +### Finding contradicting if rules |
| 75 | + |
| 76 | +``` r |
| 77 | +rules <- validator( |
| 78 | + if (nace == "a") export == "y", |
| 79 | + if (nace == "a") export == "n" |
| 80 | +) |
| 81 | + |
| 82 | +conflicts <- detect_contradicting_if_rules(rules, verbose=TRUE) |
| 83 | +#> 1 contradiction(s) with if clauses found: |
| 84 | +#> When nace == "a": |
| 85 | +#> V1: if (nace == "a") export == "y" |
| 86 | +#> V2: if (nace == "a") export == "n" |
| 87 | +``` |
| 88 | + |
| 89 | +``` r |
| 90 | +print(conflicts) |
| 91 | +#> $`nace == "a"` |
| 92 | +#> [1] "V1" "V2" |
| 93 | +``` |
| 94 | + |
73 | 95 | ## Simplifying |
74 | 96 |
|
75 | 97 | The function `simplify_rules` combines most simplification methods of |
|
0 commit comments