Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"))
Expand Down
7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
39 changes: 34 additions & 5 deletions R/regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions R/survival.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,10 @@ buildSurvfitHeader <- function(
) {
ciPart <- paste0(
" (",
gtsummary::style_number(confLevel),
"% CI)"
confLevel,
"% ",
gtsummary:::translate_string("CI"),
")"
)

typePart <- switch(
Expand Down
8 changes: 1 addition & 7 deletions R/tblreglinear.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 11 additions & 0 deletions R/tblsurvfit.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 1 addition & 7 deletions R/tblunireglinear.b.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion jamovi/0000.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down