Statistical Methods
Rebuild a contingency table from frequency rows
Define the task
Identify what a row represents before counting records. A summarized extract can contain one row per site, category and frequency. Counting its rows treats every combination as one observation. Check that frequencies represent counts of disjoint units and that they are nonnegative whole numbers. Keep overlapping summaries and subtotal rows out of the input.
Carry out the check
Sum the count field over the intended classifications. In an R formula for xtabs place the frequency field on the left and the grouping variables on the right. Compare cell totals and both margins with an independent source tally. Establish which combinations were eligible before distinguishing an observed zero from an uncollected cell.
Worked hypothetical example
In a hypothetical table, site X contributes 8 accepted and 2 flagged records. Site Y contributes 3 accepted and 7 flagged records. Four input rows represent 20 records. Accepted and flagged totals are 11 and 9. A grand total of four reveals that the aggregation counted rows. These totals alone cannot identify duplicates concealed inside a contributing source.
Method checked 10 November 2026 against R documentation: Cross Tabulation.