Grouping for grand_summary_rows in {gt}

Hi everyone,

I'm wondering whether there's a way to use groups inside of grand_summary_rows in {gt}. The obvious use case for this to me would be for financial balance sheets where the total should show equal values for assets and liabilities + equity, but I'm sure that this is one of many use cases for such a feature.

Imagine I had a GT with two grouping vars: category and sub_category. I'd like to use something like the following to produce a summary row with each category's corresponding value column.

  columns = vars(value),
  groups = "category"
    fns = list(
      total_assets_per_category = "sum"

Is this already possible somehow, or am I missing something? The code above fails with this error:

Error in summary_rows(data, groups = NULL, columns = columns, fns = fns, : formal argument "groups" matched by multiple actual arguments

This is a really cool package, and I'm excited about it's potential. Particularly once themes get introduced! :smile:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.