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 S3 methods for sorting & filtering hierarchical tables #2097

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

edelarua
Copy link
Collaborator

@edelarua edelarua commented Dec 9, 2024

What changes are proposed in this pull request?

  • Added S3 methods tbl_sort.tbl_hierarchical() and tbl_filter.tbl_hierarchical() to sort and filter hierarchical tables.

Closes #2096

To consider:

  • Do we need the .stat argument or just require users to include "n" in their table if they want to use it?
  • When filtering, if there are no rows left in a section do we still keep the summary row for that section if it it meets the criteria?

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

This is awesome @edelarua ! Thank you!!

When we're back from the holidays, let's chat about the user API. Maybe we can make it easier to implement from their end with respect to specifying the expression for filtering, for example. For example, would it be easier for them to specify the filter like p >= 0.05 instead of t = 0.05, .stat = "p"?

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 S3 methods to sort and filter hierarchical tables
2 participants