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

Big footnote updates #2083

Merged
merged 14 commits into from
Dec 11, 2024
Merged

Big footnote updates #2083

merged 14 commits into from
Dec 11, 2024

Conversation

ddsjoberg
Copy link
Owner

@ddsjoberg ddsjoberg commented Nov 27, 2024

What changes are proposed in this pull request?

  • Updates to the handling of footnotes. Previously, header footnotes were handled with modify_footnote() and modify_table_styling(footnote). It was possible to also include footnotes in the table body with modify_table_styling(footnote), but this was largely a hidden feature. Also confusingly, a special abbreviation footnote was handled with modify_footnote(abbreviation=TRUE).

    In this update, we now export separate user-facing functions for each of these with clearer names and scope: modify_footnote_header(), modify_footnote_body(), and modify_abbreviation(). As the names indicate, the modify_footnote_header() and modify_footnote_body() functions place footnotes in the header and table body. Abbreviations are now treated like source notes and do not have footnote markers associated with them. We also export functions remove_footnote_header(), remove_footnote_body(), and remove_abbreviation() to remove previously assigned footnotes and abbreviations.

    Also, multiple footnotes may now reference the same cell in the table or column header by utilizing the modify_footnote_header(replace=FALSE), modify_footnote_body(replace=FALSE) argument.

  • Previously, source notes were an undocumented feature and only a single source note could be included in a table. We now export modify_source_note() and remove_source_note() to add and remove any number of source notes. Also, when merging and stacking tables, previously due to the one source note limit, only the first source note was retained. Now all source notes will be included below the resulting table. This is different behavior compared to previous versions of the package and in rare cases may result in a different source note. Moreover, kableExtra output now supports source notes, where previously they were omitted.

If there is an GitHub issue associated with this pull request, please provide link.
closes #1675


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 ddsjoberg marked this pull request as ready for review December 10, 2024 04:21
Copy link
Collaborator

@ayogasekaram ayogasekaram left a comment

Choose a reason for hiding this comment

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

this looks amazing! Thanks @ddsjoberg

@ddsjoberg ddsjoberg merged commit 18f64b2 into main Dec 11, 2024
7 checks passed
Copy link
Collaborator

@edelarua edelarua left a comment

Choose a reason for hiding this comment

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

I love it!! Less overlapping/cluttered and much easier to understand what each function is meant to do. Very nice that you can add new footnotes without replacing the old ones :)

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.

v2.0 modify_footnote() updates
3 participants