Skip to content

Conversation

@rich-iannone
Copy link
Member

When formatting a table with a two-column stub arrangement, the group label wasn't being used to generate the cell matrix (the left-most cell corresponding to a group label was taken from the table body). This is wrong as the group labels are placed in the groups_rows_df table, where they undergo rendering and that's where footnote marks are affixed to them.

This PR modifies the body row rendering in the separate HTML, LaTeX, and RTF implementations. Several snapshot tests have been added to capture the fix. Here is the code that illustrates the problem, with a screenshot showing that the change was successful.

pizzaplace %>%
  dplyr::filter(name %in% c("soppressata", "peppr_salami")) %>%
  dplyr::group_by(name, size) %>%
  dplyr::summarize(`Pizzas Sold` = dplyr::n(), .groups = "drop") %>%
  gt(rowname_col = "size", groupname_col = "name") %>%
  summary_rows(
    groups = TRUE,
    columns = `Pizzas Sold`,
    fns = list(TOTAL = "sum"),
    formatter = fmt_number,
    decimals = 0,
    use_seps = TRUE
  ) %>%
  tab_options(row_group.as_column = TRUE) %>%
  tab_footnote(
    footnote = "The Pepper-Salami.",
    cells_row_groups(groups = "peppr_salami")
  )

group-label-footnote-fix

Fixes: #1001

@rich-iannone rich-iannone marked this pull request as ready for review August 18, 2022 04:58
@rich-iannone rich-iannone requested a review from cscheid August 18, 2022 05:03
cscheid
cscheid previously approved these changes Aug 18, 2022
Copy link
Member

@cscheid cscheid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See if it makes sense to change the line on utils_render_html.R as I suggested, otherwise LGTM.

Copy link
Member

@cscheid cscheid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@rich-iannone rich-iannone merged commit 9d50adf into master Aug 18, 2022
@rich-iannone rich-iannone deleted the use-group-label-two-col-stub branch August 18, 2022 15:51
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.

Footnotes not printing marker when row_group.as_column is set to TRUE

3 participants