Add add_label_column() to split labels into a value column - #315
Merged
Conversation
Melkiades
marked this pull request as ready for review
September 2, 2026 11:45
Melkiades
commented
Sep 2, 2026
Melkiades
commented
Sep 2, 2026
Contributor
Code Coverage SummaryDiff against mainResults for commit: 93e2244 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
Contributor
Unit Tests Summary 1 files 314 suites 1m 51s ⏱️ Results for commit 93e2244. ♻️ This comment has been updated with latest results. |
Contributor
Unit Test Performance Difference
Additional test case details
Results for commit 96726ce ♻️ This comment has been updated with latest results. |
Melkiades
force-pushed
the
modify_value_column@main
branch
2 times, most recently
from
September 2, 2026 12:00
b57b58e to
a6724b2
Compare
Melkiades
commented
Sep 2, 2026
Extract the "value column" layout from tbl_shift(strata_location = "new_column") into a standalone exported helper. It adds a new label0 column from an expression evaluated in the table body, then handles alignment, indentation, and headers. The helper adds two options tbl_shift did not need so nested count tables (e.g. LBT05 in tlg.templates) can reuse it: `.after` to place the new column on either side of label, and `indent = NULL` to keep an existing nested indentation. tbl_shift now calls the helper; its output is unchanged. closes #314
Melkiades
force-pushed
the
modify_value_column@main
branch
from
September 3, 2026 14:29
a6724b2 to
c7296f0
Compare
Give the add_label_column() branch a higher version than main so dependents pin it via the version constraint and dependency resolvers install this branch instead of a cached same-version crane.
wzfrank
self-requested a review
September 3, 2026 18:54
wzfrank
approved these changes
Sep 3, 2026
wzfrank
left a comment
Collaborator
There was a problem hiding this comment.
I think this looks good. Thank you!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are proposed in this pull request?
add_label_column()to split a{gtsummary}table's row labels into a new left label column (label0) and the existinglabelcolumn, computing the new column from an expression evaluated in the table body. ([Feature Request]: Add add_label_column() to split row labels into a new label column #314, @Melkiades)This is the
strata_location = "new_column"layout oftbl_shift()extracted into a standalone, exported helper so nested count and shift tables can reuse it instead of hand-rollingmodify_table_body()+ alignment + indent + header.tbl_shift()now calls the helper; its output is unchanged (snapshots identical).The helper adds two options
tbl_shift()did not need, so nested count tables (e.g. LBT05 in{tlg.templates}) can adopt it:.afterto place the value column on either side oflabel, andindent = NULLto preserve an existing nested indentation. The API is intentionally strict for now and can grow as more templates adopt it.Reference GitHub issue associated with pull request. closes #314
Pre-review Checklist (if item does not apply, mark is as complete)
usethis::pr_merge_main()devtools::test_coverage()