Skip to content

Tabulate SUMMARISE clause - #622

Draft
teunbrand wants to merge 30 commits into
mainfrom
tabulate-summarise
Draft

teunbrand wants to merge 30 commits into
mainfrom
tabulate-summarise

Conversation

@teunbrand

Copy link
Copy Markdown
Collaborator

This PR adds a row-summarising clause to the tabulate syntax.

I think the doc pages give the best introduction, but briefly:

TABULATE *
  SUMMARISE mean OF bill_len, bill_dep

Adds a new row after every group which will the display the summarised mean for the bill_len and bill_dep columns.

Is typical syntax for a standard clause. Notably, the operation (mean in the example) can be a template with keywords and limited arithmetic, so that e.g. ({mean - se}, {mean + se}) will render to something like (0.08, 12.04).

The row labels for summary rows are placed in the same columns stub row labels (FORMAT STUB). If no suitable stub column exists, one will be created.

setup_rows renumbers a separated facet's multi-rank group keys to single
ids right after the reorder, so nothing downstream ever sees the
multi-rank keys the sort needed. collapse_group_columns sheds its rows
parameter and renumbering pass; the shared collapses() predicate decides
both sides.
compute_summaries runs between setup_columns and apply_formats, on the
raw numeric values, and its chunks flow to build_cells. End-to-end tests
cover grand and group placement, rowlabel, clause order, separated-facet
re-keying, and the error paths.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant