13A.26 Pivot tables and matrix summaries
A pivot table places levels from --table-rows down the page and levels from --table-columns across it, summarising --table-value with --table-fun. The default function is mean. This layout is useful for concentration by time and dose, response by visit and arm, or exposure by formulation and population.
The frozen geometric-mean concentration matrix has TIME rows, DOSE columns, DV values, and geomean as its function. It is a compact numeric companion to the tile plot. Each matrix cell still needs a denominator; a separate summary table provides N and variability.
Available functions follow the summary-function catalogue, including mean, median, sum, min, max, n, sd, geomean, q1, and q3. Totals can be requested, but an overall mean across unequal cells may have a different weighting than a mean of displayed cell means. Clarify whether totals are record-weighted.
Missing row or column combinations create empty cells, not zeros. Sorting of textual levels may differ from clinical order; derive ordered labels upstream or use numeric codes with clear display expectations.
Pivot tables are presentation transforms, not data reshaping outputs for later modelling. Keep the long source and long summary as validation evidence. When the matrix is wide, units and the meaning of the function belong in the title or footnote; column labels alone rarely communicate whether cells are means, medians, totals, or counts.
Cross-check a few cells against filtered source rows and ensure repeated-dose occasions or DVID values were not unintentionally pooled.
Common mistakes
- Replacing empty cells with zero.
- Reporting a matrix without cell N.
- Assuming totals are averages of displayed cells.
- Accepting alphabetical order as clinical order.
Checklist
- Define row, column, value, and function.
- Provide N/variability in a companion table.
- Distinguish empty from zero.
- Verify level order.
- Check positivity for geometric means.
Further reading
See tile heatmaps, summary tables, statistics, and worked report pack.