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

Add hierarchy group levels to table_body in tbl_hierarchical() #2072

Merged
merged 9 commits into from
Nov 25, 2024

Conversation

edelarua
Copy link
Collaborator

What changes are proposed in this pull request?

  • Added columns to table_body as returned by tbl_hierarchical() to keep information on all hierarchy levels.

Closes #2070

@ddsjoberg 2 questions:

  • What do we want to name these columns? variableXX and variableXX_level? I wasn't sure since we already have a variable column in table_body so I left it as groupXX and groupXX_level for now.
  • Do we want to add the innermost level as well even though it should always be represented by variable where applicable?

Reviewer Checklist (if item does not apply, mark is as complete)

  • PR branch has pulled the most recent updates from main branch.
  • If a bug was fixed, a unit test was added.
  • Run pkgdown::build_site(). Check the R console for errors, and review the rendered website.
  • Code coverage is suitable for any new functions/features: devtools::test_coverage()
  • usethis::use_spell_check() runs with no spelling errors in documentation
  • All GitHub Action workflows pass with a ✅

When the branch is ready to be merged into master:

  • Update NEWS.md with the changes from this pull request under the heading "# gtsummary (development version)". If there is an issue associated with the pull request, reference it in parentheses at the end update (see NEWS.md for examples).
  • Increment the version number using usethis::use_version(which = "dev")
  • Run usethis::use_spell_check() again
  • Approve Pull Request
  • Merge the PR. Please use "Squash and merge".

@ddsjoberg
Copy link
Owner

ddsjoberg commented Nov 20, 2024

Thank you @edelarua !

What do we want to name these columns? variableXX and variableXX_level? I wasn't sure since we already have a variable column in table_body so I left it as groupXX and groupXX_level for now.

I think that is perfect.

Do we want to add the innermost level as well even though it should always be represented by variable where applicable?

Probably don't need it right? I could go either way

@ddsjoberg ddsjoberg self-requested a review November 22, 2024 15:57
Copy link
Owner

@ddsjoberg ddsjoberg left a comment

Choose a reason for hiding this comment

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

this is great, i love it! Can we make one small change? Can you move the grouping columns to after the row_type column? I prefer keeping all the hidden column grouped together in the beginning of the data frame.

@edelarua
Copy link
Collaborator Author

this is great, i love it! Can we make one small change? Can you move the grouping columns to after the row_type column? I prefer keeping all the hidden column grouped together in the beginning of the data frame.

Done!

Copy link
Owner

@ddsjoberg ddsjoberg left a comment

Choose a reason for hiding this comment

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

Lovely, thank you @edelarua !

@ddsjoberg ddsjoberg merged commit 0915847 into main Nov 25, 2024
7 checks passed
@ddsjoberg ddsjoberg deleted the 2070_var_levels_tbl_hierarchical branch November 25, 2024 17:32
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.

Add variable levels to tbl_hierarchical()* table body
2 participants