Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge tables #1691

Open
2 tasks done
roaldarbol opened this issue May 31, 2024 · 1 comment
Open
2 tasks done

Merge tables #1691

roaldarbol opened this issue May 31, 2024 · 1 comment
Assignees

Comments

@roaldarbol
Copy link

roaldarbol commented May 31, 2024

Prework

Proposal

I'd really like something like the tbl_merge() function from {gtsummary}, where two tables with similar columns can be "stacked".
Screenshot 2024-05-31 at 20 29 59

For the user it would look something along the lines of:

gt_merge(
  tbls = list(gt_tbl_a, gt_tbl_b),
  spanner_cols = col_that_differs,
  tab_spanner = c("**First `gt` table**", "**Second `gt` table**")
)

The assumption is of course that they are two tables with identical column names and groupings, where so the main functionality that would need to be implemented would be:

  • Checking which columns match between the two tables.
  • Checking groupings.

spanner_cols could then be used to automatically assign the factors of that column as the spanner titles, and as an alternative tab_spanner could be used to manually edit the spanner labels. If multiple cols are given, they would make additional nestings (if that is possible in gt).

There would be some decisions to be made about what would happen to non-matching columns (if they're present I'd argue drop as default.

@roaldarbol
Copy link
Author

Just found #255 which was closed last week. Seems to be the same issue; there was no note on why it was closed. Was it completed or just considered out of scope?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants