rstudio / gt

Easily generate information-rich, publication-quality tables from R
https://gt.rstudio.com
Other
1.99k stars 200 forks source link

Summary statistics in group heading #655

Open thomas-neitmann opened 3 years ago

thomas-neitmann commented 3 years ago

It would be great to be able to add summary statistics in the row of a group heading as done in this table: image

eastclintw00d commented 3 years ago

I would second this!

rich-iannone commented 1 year ago

@thomas-neitmann @eastclintw00d Does this count? Look at second example in https://gt.rstudio.com/dev/reference/grand_summary_rows.html#examples (from work done in https://github.com/rstudio/gt/pull/1171). This is not a group header row but rather a grand summary row put at the top of the table. Same could now be done for group summary rows (through the side argument).

rich-iannone commented 1 year ago

But I see an/the issue: you need groups to generate these summaries, necessitating a dedicated row for the row group label. A summary row is another discrete row. It would be great to coalesce the row group label with the single summary row, which would be right below. Perhaps a compromise is to hide the row group label and re-use that label for the single summary row (fixed at the top of each group).