Since updating the package to 2.0.0 I've experienced an issue with modify_header() throwing an error when using it to modify the header of gtsummary tables created using tbl_svysummary() to add unweighted counts (i.e., {N_unweighted} glue value). The error provided suggests (to me) it's not recognising {N_unweighted}, but this option remains featured in the function documentation, so I don't think it's a deliberate change.
If I revert the installed version of the package to 1.7.2 (using r devtools::install_version("gtsummary", version = "1.7.2")) then everything works as expected, so I think this is a change related to the update. I can replicate the issue in a simple setup and with an example dataset (not just my research dataset), so I would anticipate this having the potential to affect others.
I'm running:
R version 4.4.1 (2024-06-14) -- "Race for Your Life"
Platform: aarch64-apple-darwin20 (64-bit)
Also, first time submitting an issue, so my apologies if I've overlooked providing anything needed or I am overlooking something obvious!
# Load minimal packages
library(dplyr)
library(survey)
library(gtsummary)
# Load sample dataset included in survey package
data(election)
election_design <- svydesign(id = ~1,
fpc = ~p,
data = election_pps,
pps = "brewer")
# Create gtsummary tbl_svysummary table
table <- tbl_svysummary(election_design, include = c("Bush", "Kerry"))
# Request the weighted N in the table header
table |> modify_header(stat_0 ~ "N = {N}")
# Works fine (but it's not what's wanted)
# Request the unweighted N in the table header
# This should just give the same as the default
table |> modify_header(stat_0 ~ "N = {N_unweighted}")
# Error message says:
# Error in `modify_header()`:
#! There was an error in the `glue::glue()` evaluation of "N = {N_unweighted}" for column "label".
#ℹ Run `gtsummary::show_header_names()` for information on values available for glue interpretation.
# So let's run show_header_names to see if it has useful advice
gtsummary::show_header_names(table)
# It tells us about the columns we can rename, but no advice on values available for glue interpretation.
Since updating the package to 2.0.0 I've experienced an issue with modify_header() throwing an error when using it to modify the header of gtsummary tables created using tbl_svysummary() to add unweighted counts (i.e., {N_unweighted} glue value). The error provided suggests (to me) it's not recognising {N_unweighted}, but this option remains featured in the function documentation, so I don't think it's a deliberate change.
If I revert the installed version of the package to 1.7.2 (using
r devtools::install_version("gtsummary", version = "1.7.2")
) then everything works as expected, so I think this is a change related to the update. I can replicate the issue in a simple setup and with an example dataset (not just my research dataset), so I would anticipate this having the potential to affect others.I'm running: R version 4.4.1 (2024-06-14) -- "Race for Your Life" Platform: aarch64-apple-darwin20 (64-bit)
Also, first time submitting an issue, so my apologies if I've overlooked providing anything needed or I am overlooking something obvious!