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.

Related reading

Reading path: Analyze data. Guide 111 of 112. Choose any guide to suit your project.

Statistical Methods

Check Expected Counts Before a Contingency-Table Test

Audit category counts, independence, and sparse cells before interpreting a categorical association test.

Statistical Methods

Rebuild an index from successive percentage changes

Check how sequential gains and losses combine and distinguish a relative change from a percentage-point change.

Browse this reading pathTools for this stageGuides and downloads for this stage