
Verify recoded category counts against the counts a release published
Source:R/categorical_guard.R
morie_marginals_verify.RdThe check that would have caught a swapped race label on the day: after a recode, the number of rows per label must equal the counts the source published for those labels. If they do not, the function also tries every permutation of the labels and says whether the observed counts match the published ones under some relabelling, which is the signature of labels attached to the wrong groups.
Arguments
- x
A character or factor vector after recoding.
- published
Named numeric vector: label = published count.
- tolerance
Absolute count tolerance per label (default 0).
- strict
When
TRUE(the default) a mismatch is an error, so a pipeline stops on the day. WhenFALSEthe result is returned withok = FALSE, thepermutationthat would explain the counts and themessagethe error would have carried.