Skip to content

Commit da22d09

Browse files
committed
Merge branch 'dev'
2 parents e912640 + 4c3d17e commit da22d09

48 files changed

Lines changed: 2163 additions & 3253 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ GEMINI.md
2020
cran-comments.md
2121
^CRAN-SUBMISSION$
2222
test_updates.R
23+
^.pre-commit-config.yaml
24+
^.lintr

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ inst/docs/
165165

166166
# Other
167167
.claude
168+
CLAUDE.md
168169
.gemini
170+
GEMINI.md
169171
CRAN-SUBMISSION
170172
cran-comments.md
171173
test_updates.R

.lintr

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
linters:
2+
linters_with_defaults(
3+
object_usage_linter = NULL
4+
)

.pre-commit-config.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Pre-commit hooks for R & Quarto projects
2+
# Requires: pre-commit (https://pre-commit.com)
3+
# R packages: install.packages(c("precommit", "styler", "lintr"))
4+
#
5+
# Setup:
6+
# precommit::use_precommit()
7+
#
8+
# To remove: simply delete this file.
9+
repos:
10+
- repo: https://github.com/lorenzwalthert/precommit
11+
rev: v0.4.3.9020
12+
hooks:
13+
- id: style-files
14+
args: [--style_pkg=styler, --style_fun=tidyverse_style]
15+
- id: lintr
16+
- id: parsable-R
17+
- id: no-browser-statement
18+
- id: no-debug-statement
19+
- repo: https://github.com/pre-commit/pre-commit-hooks
20+
rev: v6.0.0
21+
hooks:
22+
- id: check-added-large-files
23+
args: ['--maxkb=200']
24+
- id: end-of-file-fixer
25+
- repo: local
26+
hooks:
27+
- id: forbid-to-commit
28+
name: Don't commit common R artifacts
29+
entry: Cannot commit .Rhistory, .RData, .Rds or .rds.
30+
language: fail
31+
files: '\.(Rhistory|RData|Rds|rds)$'
32+
# `exclude: <regex>` to allow committing specific files

DESCRIPTION

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: sumExtras
22
Title: Extra Functions for 'gtsummary' Table Styling
3-
Version: 0.3.1
3+
Version: 1.0.0
44
Authors@R:
55
c(
66
person(
@@ -39,11 +39,8 @@ Depends:
3939
Suggests:
4040
broom (>= 1.0.5),
4141
broom.helpers (>= 1.20.0),
42-
ggplot2,
4342
knitr,
4443
labelled,
45-
quarto,
46-
scales,
4744
survey,
4845
testthat (>= 3.0.0),
4946
tibble
@@ -53,7 +50,7 @@ Imports:
5350
dplyr,
5451
gt (>= 0.9.0),
5552
gtsummary (>= 1.7.0),
56-
purrr,
5753
rlang
58-
URL: https://github.com/kyleGrealis/sumExtras
54+
URL: https://github.com/kyleGrealis/sumExtras,
55+
https://www.kyleGrealis.com/sumExtras/
5956
BugReports: https://github.com/kyleGrealis/sumExtras/issues

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2025
1+
YEAR: 2025-2026
22
COPYRIGHT HOLDER: Kyle Grealis

NAMESPACE

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
export(add_auto_labels)
44
export(add_group_colors)
55
export(add_group_styling)
6-
export(apply_labels_from_dictionary)
76
export(clean_table)
87
export(extras)
98
export(get_group_rows)
109
export(theme_gt_compact)
1110
export(use_jama_theme)
1211
importFrom(dplyr,across)
1312
importFrom(dplyr,case_when)
13+
importFrom(dplyr,distinct)
1414
importFrom(dplyr,filter)
1515
importFrom(dplyr,if_else)
1616
importFrom(dplyr,left_join)
@@ -27,18 +27,15 @@ importFrom(gtsummary,all_stat_cols)
2727
importFrom(gtsummary,all_tests)
2828
importFrom(gtsummary,as_gt)
2929
importFrom(gtsummary,bold_labels)
30+
importFrom(gtsummary,bold_p)
3031
importFrom(gtsummary,modify_header)
3132
importFrom(gtsummary,modify_indent)
3233
importFrom(gtsummary,modify_missing_symbol)
3334
importFrom(gtsummary,modify_table_body)
3435
importFrom(gtsummary,modify_table_styling)
3536
importFrom(gtsummary,set_gtsummary_theme)
3637
importFrom(gtsummary,style_pvalue)
37-
importFrom(gtsummary,tbl_regression)
38-
importFrom(gtsummary,tbl_strata)
39-
importFrom(gtsummary,tbl_summary)
4038
importFrom(gtsummary,theme_gtsummary_compact)
41-
importFrom(purrr,map_chr)
4239
importFrom(rlang,"%||%")
4340
importFrom(rlang,abort)
4441
importFrom(rlang,warn)

NEWS.md

Lines changed: 44 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,25 @@
1-
# sumExtras 0.3.1
1+
# sumExtras 1.0.0 (2026-02-09)
2+
3+
## Breaking Changes
4+
5+
* Removed `apply_labels_from_dictionary()`. Use `attr(data$var, "label") <- "Label"` directly, or the labelled package for bulk attribute labeling.
6+
7+
## New Features
8+
9+
* `extras()` now bolds significant p-values (`bold_p()`) automatically when p-values are added.
10+
* New `header` parameter in `extras()` controls the label column header text (default `""`).
11+
* New `symbol` parameter in `clean_table()` and `extras()` controls the missing value replacement string (default `"---"`).
12+
* `add_group_colors()` now accepts a vector of colors (one per group) in addition to a single color for all groups.
13+
14+
## Improvements
15+
16+
* `extras()` now handles `tbl_regression` gracefully: `overall` and `pval` are silently ignored (regression tables already have model p-values), and `bold_p()` is applied automatically. No more warnings when using `extras()` with default arguments on regression tables.
17+
* `extras()` auto-labeling via `options(sumExtras.auto_labels = TRUE)` is now fully tested.
18+
* Removed startup message. The package now loads silently.
19+
* Dropped `purrr` from Imports (4 dependencies instead of 5).
20+
* New vignettes: `vignette("options")` and `vignette("themes")`.
21+
22+
# sumExtras 0.3.1 (2026-01-22)
223

324
## Improvements
425

@@ -9,7 +30,7 @@
930
- `extras(non_stratified_tbl, overall = TRUE)` - Warns (user explicitly requested)
1031
- `extras(non_stratified_tbl, pval = TRUE)` - Warns (user explicitly requested)
1132

12-
# sumExtras 0.3.0
33+
# sumExtras 0.3.0 (2026-01-15)
1334

1435
## New Features
1536

@@ -21,9 +42,9 @@
2142

2243
## Improvements
2344

24-
* Extended list of zero or `NA` value recognition used by `clean_table`. This fixes the funcion previously not recognizing `0 (0)` for Mean (SD).
45+
* Extended list of zero or `NA` value recognition used by `clean_table`. This fixes the function previously not recognizing `0 (0)` for Mean (SD).
2546

26-
# sumExtras 0.2.0
47+
# sumExtras 0.2.0 (2026-01-05)
2748

2849
## Breaking Changes
2950

@@ -34,17 +55,16 @@
3455
* New `add_group_colors()` function provides a clean, pipeable way to add background colors to group headers
3556
- Combines text formatting, gt conversion, and color application in one step
3657
- Eliminates need for manual `get_group_rows()` and `as_gt()` calls
37-
- Perfect for creating publication-ready tables quickly
38-
- Reduces typical styling code from 20+ lines to ~11 lines (45% reduction)
58+
- Reduces typical styling code from 20+ lines to ~11 lines
3959

4060
## Documentation
4161

4262
* Updated all examples and vignettes to use new function names
4363
* Improved README with cleaner side-by-side comparison showcasing the new API
44-
* Added comprehensive `add_group_colors()` section to styling vignette with side-by-side manual vs. convenience pattern comparison
64+
* Added `add_group_colors()` section to styling vignette with side-by-side manual vs. convenience pattern comparison
4565
* Updated all function references across documentation
4666

47-
# sumExtras 0.1.1 (development version)
67+
# sumExtras 0.1.1 (2025-11-15)
4868

4969
## Bug Fixes
5070

@@ -60,57 +80,22 @@
6080
reducing package dependency footprint
6181
* Replaced `purrr::walk2()` with traditional for-loop in `apply_labels_from_dictionary()`
6282
for improved code clarity and maintainability
63-
* `add_auto_labels()` now displays a clearer, more user-friendly message when
64-
automatically finding a dictionary in the environment: "Auto-labeling from
65-
'dictionary' object in your environment (this message will only show once per
66-
session)". The message now only appears once per R session to reduce clutter
6783

6884
## Documentation
6985

7086
* Added package-level documentation (`sumExtras-package`) with notes about
7187
dependency on gtsummary internal structures and minimum version requirements
72-
* Enhanced `add_auto_labels()` documentation with comprehensive explanation of R's
73-
ecosystem label convention, including integration with haven, Hmisc, and ggplot2 4.0+.
74-
New documentation clarifies how labels work across the R ecosystem using standard
75-
`"label"` attributes without special packages or formats
76-
* Added extensive documentation to `apply_labels_from_dictionary()` explaining the
77-
implementation approach using native R attributes and ecosystem compatibility
78-
* Updated README with new "How Labels Work" section explaining how the labeling system
79-
uses R's standard attribute convention, enabling seamless integration with ggplot2,
80-
gt, Hmisc, and other label-aware packages
88+
* Enhanced `add_auto_labels()` documentation with implementation notes about
89+
gtsummary internals
8190
* Added Fisher test documentation in `extras()` explaining why Monte Carlo
8291
simulation is used
8392
* Created CITATION file for proper package attribution
84-
* Added comprehensive new vignettes covering key sumExtras workflows:
85-
- `vignette("labeling")` - **Automatic Variable Labeling**: Detailed guide to unified labeling
86-
across gtsummary tables and ggplot2 plots. Covers R's label attribute system, creating and
87-
maintaining data dictionaries, automatic label discovery with `add_auto_labels()`, setting
88-
label attributes with `apply_labels_from_dictionary()`, label priority control via
89-
`sumExtras.preferDictionary` option, and cross-package workflows demonstrating seamless
90-
integration between gtsummary, ggplot2, and gt
91-
- `vignette("styling")` - **Table Styling and Formatting**: Advanced techniques for creating
92-
publication-ready tables. Covers creating visually organized tables with group headers,
93-
styling group headers with text formatting via `group_styling()`, adding background colors
94-
for emphasis with `get_group_rows()`, theme management across gtsummary and gt with
95-
`use_jama_theme()` and `theme_gt_compact()`, and combining techniques for professional
96-
table presentation
9793

9894
## Testing
9995

100-
* **Comprehensive labeling test suite added** - 51 new test cases (826+ lines) in
101-
`test-labels.R` providing thorough coverage of the labeling system:
102-
- Dictionary auto-discovery and session-scoped messaging behavior
103-
- Label priority logic testing both default (attributes > dictionary) and
104-
`preferDictionary = TRUE` modes
105-
- Comprehensive error validation with proper error classes for invalid inputs
106-
- Edge case coverage: NA values, empty/single-row data, very long labels
107-
- Integration tests validating all 9 vignette workflow scenarios
108-
- Performance testing with large dictionaries (1000+ entries) and wide data
109-
- Robustness testing with special characters, unicode, and underscores
11096
* Added unicode and emoji test to verify label handling of special characters
11197
(emoji, Greek letters, symbols)
11298
* Updated all regex tests to use base R `grepl()` instead of stringr
113-
* Package now has 245 passing test assertions with 100% success rate
11499

115100
# sumExtras 0.1.0 (2025-11-15)
116101

@@ -127,22 +112,19 @@
127112

128113
* Added `use_jama_theme()` function for explicit JAMA compact theme application
129114
* Users can now opt-in to the recommended JAMA theme by calling `use_jama_theme()`
130-
* `add_auto_labels()` now supports `tbl_regression` and `tbl_uvregression` objects in addition to `tbl_summary` objects, enabling automatic variable labeling for regression tables from dictionary files (55bc540)
115+
* `add_auto_labels()` now supports `tbl_regression` and `tbl_uvregression` objects in addition to `tbl_summary` objects (55bc540)
131116
* `add_auto_labels()` now automatically searches the calling environment for a
132117
`dictionary` object when no dictionary is explicitly provided
133118
* `add_auto_labels()` can now read label attributes directly from data as a
134-
fallback when no dictionary is found, enabling seamless integration with
135-
{haven}, {labelled}, and other packages that set label attributes
136-
* `add_auto_labels()` implements a smart label priority hierarchy: Manual labels
137-
(set via `label = list()` in `tbl_summary()`) always take precedence, followed
138-
by dictionary/attribute labels (based on `sumExtras.preferDictionary` option),
139-
then default variable names
119+
fallback when no dictionary is found, so it works with {haven}, {labelled},
120+
and other packages that set label attributes
121+
* `add_auto_labels()` uses a fixed label priority: manual labels (from
122+
`label = list()`) take precedence, then attribute labels, then dictionary
123+
labels, then variable names
140124
* Added `apply_labels_from_dictionary()` function to set label attributes on
141-
data from a dictionary, enabling cross-package workflows with ggplot2 4.0+
142-
automatic axis labeling, gt, and other label-aware packages
143-
* Added `options(sumExtras.preferDictionary)` to control label priority when
144-
both dictionary and attribute labels are available. Default is `FALSE`
145-
(attributes preferred over dictionary)
125+
data from a dictionary for use with ggplot2 4.0+, gt, and other
126+
label-aware packages
127+
* Label priority is fixed: manual labels > attribute labels > dictionary labels
146128
* `group_styling()` gains an `indent_labels` parameter (default `0L`) to control
147129
indentation of variable labels under group headers. Set to `4L` to preserve
148130
gtsummary's default group indentation behavior
@@ -151,14 +133,13 @@
151133

152134
## Minor Improvements and Bug Fixes
153135

154-
* `add_auto_labels()` now gracefully handles missing dictionaries by falling
155-
back to label attributes instead of erroring, improving robustness in
156-
workflows where dictionary availability varies
136+
* `add_auto_labels()` now falls back to label attributes when no dictionary
137+
is found instead of erroring
157138
* Fixed missing import of `gtsummary::all_tests()` in `extras()` function
158139
* Improved regex pattern in `clean_table()` to avoid false positives (e.g., matching `"..."` or `" "`)
159140
* `extras()` now warns when `add_overall()` or `add_p()` fail instead of silently continuing
160141
* Fixed `modify_indent()` column parameter in `group_styling()` - column name now properly quoted as "label" to ensure correct indentation when rendering vignettes in pkgdown
161-
* Enhanced `extras()` to warn when called with unsupported table types (tbl_regression, tbl_strata, non-stratified tables) instead of silently skipping features
142+
* `extras()` now warns when called with unsupported table types (tbl_regression, tbl_strata, non-stratified tables) instead of silently skipping features
162143
* Fixed `clean_table()` handling of `tbl_strata` objects by detecting when `var_type` column is missing
163144

164145
## Performance Improvements
@@ -175,8 +156,8 @@
175156
# sumExtras 0.0.0.9000 (development version)
176157

177158
* Initial development release of sumExtras
178-
* Added `extras()` function for streamlined gtsummary table styling
159+
* Added `extras()` function for one-call gtsummary table styling
179160
* Added `clean_table()` for standardized missing value display
180161
* Added `add_auto_labels()` and `create_labels()` for automatic variable labeling
181162
* Added `theme_gt_compact()` for JAMA-style gt table themes
182-
* Added `group_styling()` for enhanced group header formatting
163+
* Added `group_styling()` for group header formatting

0 commit comments

Comments
 (0)