From 8d156ab1d8e1a524d155bde0772731ce5c0fabb7 Mon Sep 17 00:00:00 2001 From: NourEdinDarwish Date: Sun, 24 May 2026 22:00:54 +0300 Subject: [PATCH 1/5] refactor(regression): refine estimate and merged CI header handling - Add `pipeOverrideEstimateHeader()` to override estimate column headers while preserving theme-specific suffixes (e.g., from JAMA theme). - Refactor `pipeCiMergeReg()` to construct the merged CI header label dynamically from existing formatted columns instead of hardcoding it. - Replace inline header overrides in `tblRegLinearClass` and `tblUniRegLinearClass` with the new helper. --- R/regression.R | 35 ++++++++++++++++++++++++++++++++--- R/tblreglinear.b.R | 8 +------- R/tblunireglinear.b.R | 8 +------- 3 files changed, 34 insertions(+), 17 deletions(-) diff --git a/R/regression.R b/R/regression.R index 37c94c8..13cec3e 100644 --- a/R/regression.R +++ b/R/regression.R @@ -233,6 +233,33 @@ buildUniRegTable <- function( } +# pipeOverrideEstimateHeader ------------------------------------------------ + +#' Safely override the estimate column header in a regression table +#' +#' Replaces the base estimate header (e.g. "**Beta**") with a custom label while +#' preserving any suffixes added by themes (like " (95% CI)" from JAMA). +#' +#' @param table A tbl_regression or tbl_uvregression object +#' @param options Jamovi options object +#' @return The table with the updated header +pipeOverrideEstimateHeader <- function(table, options) { + coefHeader <- if (options$standardize) { + "**Standardized Coefficient**" + } else { + "**Coefficient**" + } + + current_header <- table$table_styling$header$label[ + table$table_styling$header$column == "estimate" + ] + + new_header <- sub("^\\*\\*.*?\\*\\*", coefHeader, current_header) + table |> + gtsummary::modify_header(estimate = new_header) +} + + # pipeAddGlobalP ------------------------------------------------------------ #' Add global p-values to a regression table @@ -427,9 +454,11 @@ pipeCiMergeReg <- function(table, options) { table$table_styling$header |> dplyr::filter(.data$column == "estimate") |> dplyr::pull("label"), - " **(", - gtsummary::style_number(table$inputs$conf.level, scale = 100), - "% CI)**" + " **(**", + table$table_styling$header |> + dplyr::filter(.data$column == "conf.low") |> + dplyr::pull("label"), + "**)**" ) pattern <- paste0( diff --git a/R/tblreglinear.b.R b/R/tblreglinear.b.R index 4344017..981ad2e 100644 --- a/R/tblreglinear.b.R +++ b/R/tblreglinear.b.R @@ -111,13 +111,7 @@ tblRegLinearClass <- R6::R6Class( ) # Change header ------------------------------------------------------- - coefHeader <- if (self$options$standardize) { - "**Standardized Coefficient**" - } else { - "**Coefficient**" - } - table <- table |> - gtsummary::modify_header(estimate = coefHeader) + table <- pipeOverrideEstimateHeader(table, self$options) # Pipeline ------------------------------------------------------------ table <- pipeAddGlobalP( diff --git a/R/tblunireglinear.b.R b/R/tblunireglinear.b.R index 2f0bc52..b27b0ed 100644 --- a/R/tblunireglinear.b.R +++ b/R/tblunireglinear.b.R @@ -71,13 +71,7 @@ tblUniRegLinearClass <- R6::R6Class( ) # Change header ------------------------------------------------------- - coefHeader <- if (self$options$standardize) { - "**Standardized Coefficient**" - } else { - "**Coefficient**" - } - table <- table |> - gtsummary::modify_header(estimate = coefHeader) + table <- pipeOverrideEstimateHeader(table, self$options) # Pipeline ------------------------------------------------------------ table <- pipeAddGlobalP( From 51a1c3a8c5733bccc2545eaf39cd4faf336dad62 Mon Sep 17 00:00:00 2001 From: NourEdinDarwish Date: Sun, 24 May 2026 22:27:00 +0300 Subject: [PATCH 2/5] fix(regression): disable confidence intervals under qjecon to prevent CI abbreviation leak - Force `conf.int` to FALSE in `buildMultiRegTable()` and `buildUniRegTable()` when the journal theme is set to "qjecon". - This prevents gtsummary from generating unused `conf.low` and `conf.high` columns in the table body, avoiding stale "CI = Confidence Interval" footnotes when the columns are hidden by the theme. --- R/regression.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/regression.R b/R/regression.R index 13cec3e..9f69418 100644 --- a/R/regression.R +++ b/R/regression.R @@ -101,7 +101,7 @@ buildMultiRegTable <- function(model, options, b64Map) { ) args$exponentiate <- optTrue(options$exponentiate) - args$conf.int <- options$confInt + args$conf.int <- options$confInt && options$journal != "qjecon" args$conf.level <- options$confLevel / 100 args$intercept <- optTrue(options$intercept) @@ -213,7 +213,7 @@ buildUniRegTable <- function( ) args$exponentiate <- optTrue(options$exponentiate) - args$conf.int <- options$confInt + args$conf.int <- options$confInt && options$journal != "qjecon" args$conf.level <- options$confLevel / 100 args$add_estimate_to_reference_rows <- options$addRefRowEstimate From e9509b6fa58f463cb5850363f96849ddd32d71de Mon Sep 17 00:00:00 2001 From: NourEdinDarwish Date: Sun, 24 May 2026 23:07:10 +0300 Subject: [PATCH 3/5] fix(survival): add CI abbreviation and support native translations - Update `buildSurvfitHeader()` in `survival.R` to construct the CI header dynamically using `gtsummary:::translate_string("CI")` instead of a hardcoded English string. - Add `gtsummary::modify_abbreviation()` to the table pipeline in `tblsurvfit.b.R` to inject the translated "CI = Confidence Interval" source note globally into the table footer, ensuring the table matches `gtsummary`'s native localization behavior. --- R/survival.R | 4 +++- R/tblsurvfit.b.R | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/R/survival.R b/R/survival.R index d9dac0a..22043b1 100644 --- a/R/survival.R +++ b/R/survival.R @@ -131,7 +131,9 @@ buildSurvfitHeader <- function( ciPart <- paste0( " (", gtsummary::style_number(confLevel), - "% CI)" + "% ", + gtsummary:::translate_string("CI"), + ")" ) typePart <- switch( diff --git a/R/tblsurvfit.b.R b/R/tblsurvfit.b.R index ed8fbbe..bf5a329 100644 --- a/R/tblsurvfit.b.R +++ b/R/tblsurvfit.b.R @@ -162,6 +162,17 @@ tblSurvfitClass <- R6::R6Class( ) } + # Add translated CI abbreviation to table footer (source note) + # We use modify_abbreviation so it matches gtsummary's native + # translation behavior + table <- runSafe( + gtsummary::modify_abbreviation( + table, + gtsummary:::translate_string("CI = Confidence Interval") + ), + collector + ) + # Pipeline ------------------------------------------------------------ if (self$options$addN) { table <- runSafe(gtsummary::add_n(table), collector) From ac6c271028b093db616f26f460f65f168ccde1da Mon Sep 17 00:00:00 2001 From: NourEdinDarwish Date: Sun, 24 May 2026 23:29:18 +0300 Subject: [PATCH 4/5] fix(survival): prevent rounding of CI labels by removing style_number `gtsummary::style_number()` aggressively rounds numbers by default, which caused confidence levels with decimals (e.g., 95.5) to be incorrectly truncated or rounded to '96% CI' in the table headers. Bypassing `style_number()` and passing `confLevel` directly preserves the exact user-requested confidence level in survival tables. --- R/survival.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/survival.R b/R/survival.R index 22043b1..0f98773 100644 --- a/R/survival.R +++ b/R/survival.R @@ -130,7 +130,7 @@ buildSurvfitHeader <- function( ) { ciPart <- paste0( " (", - gtsummary::style_number(confLevel), + confLevel, "% ", gtsummary:::translate_string("CI"), ")" From bb4fe91e01b94db731914aaadbc17a63acf068dc Mon Sep 17 00:00:00 2001 From: NourEdinDarwish Date: Sun, 24 May 2026 23:44:07 +0300 Subject: [PATCH 5/5] chore: bump version to 1.3.2 --- DESCRIPTION | 2 +- NEWS.md | 7 +++++++ jamovi/0000.yaml | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b5c7227..e163c94 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: SummaryTables Title: Publication-Ready Summary Tables for Jamovi -Version: 1.3.1 +Version: 1.3.2 Authors@R: person("Nour Edin", "Darwish", , "nouredindarwish@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0009-0009-5527-4539")) diff --git a/NEWS.md b/NEWS.md index 8d61c44..711cfa9 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +## SummaryTables 1.3.2 + +* Added the missing "CI = Confidence Interval" abbreviation source note to Survival Tables. +* Fixed formatting issues with column headers and unnecessary abbreviation source notes in Regression Tables when applying specific Journal Themes. +* Fixed translation bugs where Confidence Interval (CI) texts were being overridden by English text. +* General bug-fixes and improvements. + ## SummaryTables 1.3.1 * Improved the message shown when required variables are missing. diff --git a/jamovi/0000.yaml b/jamovi/0000.yaml index 259a1ce..204eee9 100644 --- a/jamovi/0000.yaml +++ b/jamovi/0000.yaml @@ -1,7 +1,7 @@ --- title: Publication-Ready Summary Tables name: SummaryTables -version: 1.3.1 +version: 1.3.2 jms: '1.0' authors: - Nour Edin Darwish