Ensures that for every parent record with at least one child record, the
child column's values sum to the parent column's value (total == sum(lines)).
Usage
rule_sum(parent_table, parent_col, child_table, child_col, tol = 1e-06)
Arguments
- parent_table
Name of the parent table.
- parent_col
Name of the parent total column.
- child_table
Name of the child table.
- child_col
Name of the child component column.
- tol
Numeric tolerance used when verifying conservation.
Value
A flexsynth_sum_rule object.
Examples
rule_sum("claims", "total_cost", "claim_lines", "line_cost")
#> $parent_table
#> [1] "claims"
#>
#> $parent_col
#> [1] "total_cost"
#>
#> $child_table
#> [1] "claim_lines"
#>
#> $child_col
#> [1] "line_cost"
#>
#> $tol
#> [1] 1e-06
#>
#> attr(,"class")
#> [1] "flexsynth_sum_rule"