diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml index b195af0ad..23b7d74f8 100644 --- a/pkgdown/_pkgdown.yml +++ b/pkgdown/_pkgdown.yml @@ -161,6 +161,7 @@ reference: - subtitle: Style Summary Tables - contents: - modify + - modify_footnote2 - modify_source_note - modify_caption - bold_italicize_labels_levels diff --git a/tests/testthat/test-as_hux_table.R b/tests/testthat/test-as_hux_table.R index 8b85160a8..1581f1b17 100644 --- a/tests/testthat/test-as_hux_table.R +++ b/tests/testthat/test-as_hux_table.R @@ -137,10 +137,9 @@ test_that("as_hux_table passes table footnotes & footnote abbreviations correctl # customized footnotes tbl <- my_tbl_summary |> - modify_footnote( - all_stat_cols() ~ "replace old footnote", - label = "another new footnote" - ) + modify_footnote_header("replace old footnote", columns = all_stat_cols()) |> + modify_footnote_header("another new footnote", columns = label) + ht <- tbl |> as_hux_table() expect_equal( diff --git a/tests/testthat/test-as_kable_extra.R b/tests/testthat/test-as_kable_extra.R index 76347b635..86d461156 100644 --- a/tests/testthat/test-as_kable_extra.R +++ b/tests/testthat/test-as_kable_extra.R @@ -178,7 +178,7 @@ test_that("as_kable_extra passes table footnotes & footnote abbreviations correc ) tbl_fa <- tbl_fn |> - modify_footnote(stat_0 = "N = number of observations", abbreviation = TRUE) + modify_abbreviation("N = number of observations") kbl_fa <- tbl_fa |> as_kable_extra() # footnote_abbrev @@ -188,10 +188,8 @@ test_that("as_kable_extra passes table footnotes & footnote abbreviations correc # customized footnotes tbl <- my_tbl_summary |> - modify_footnote( - all_stat_cols() ~ "replace old footnote", - label = "another new footnote" - ) + modify_footnote_header("replace old footnote", columns = all_stat_cols()) |> + modify_footnote_header("another new footnote", columns = label) kbl <- tbl |> as_kable_extra() expect_snapshot_value( diff --git a/tests/testthat/test-tbl_custom_summary.R b/tests/testthat/test-tbl_custom_summary.R index e7048cc00..530f3c8c8 100644 --- a/tests/testthat/test-tbl_custom_summary.R +++ b/tests/testthat/test-tbl_custom_summary.R @@ -16,7 +16,7 @@ test_that("tbl_custom_summary() basics", { digits = ~1 ) |> add_overall(last = TRUE) |> - modify_footnote(all_stat_cols() ~ "Mean age") |> + modify_footnote_header("Mean age", columns = all_stat_cols()) |> modify_column_unhide(everything()) |> as.data.frame(col_labels = FALSE), NA diff --git a/vignettes/articles/gallery.Rmd b/vignettes/articles/gallery.Rmd index e1939f244..e24955e5d 100644 --- a/vignettes/articles/gallery.Rmd +++ b/vignettes/articles/gallery.Rmd @@ -275,7 +275,7 @@ trial |> missing = "no" ) |> modify_header(stat_0 = "**Mean (SD)**") |> - modify_footnote(stat_0 = NA) |> + remove_footnote_header(stat_0) |> add_ci() ``` @@ -341,7 +341,7 @@ gt_t1 <- trial |> tbl_summary(include = c(trt, grade), missing = "no") |> add_n() |> modify_header(stat_0 = "**n (%)**") |> - modify_footnote(stat_0 = NA_character_) + remove_footnote_header(stat_0) theme_gtsummary_compact() tbl_merge( @@ -387,7 +387,7 @@ trial |> ) |> modify_header(label = "**Model Outcome**", estimate = "**Treatment Coef.**") |> - modify_footnote(estimate = "Values larger than 0 indicate larger values in the Drug B group.") + modify_footnote_header("Values larger than 0 indicate larger values in the Drug B group.", columns = estimate) ```
diff --git a/vignettes/articles/tbl_regression.Rmd b/vignettes/articles/tbl_regression.Rmd index 3538acad9..ba70a176d 100644 --- a/vignettes/articles/tbl_regression.Rmd +++ b/vignettes/articles/tbl_regression.Rmd @@ -165,7 +165,8 @@ The {gtsummary} package comes with functions specifically made to modify and for dplyr::tribble( ~Function, ~Description, "`modify_header()`", "update column headers", - "`modify_footnote()`", "update column footnote", + "`modify_footnote_header()`", "update column header footnote", + "`modify_footnote_body()`", "update table body footnote", "`modify_spanning_header()`", "update spanning headers", "`modify_caption()`", "update table caption/title", "`bold_labels()`", "bold variable labels", diff --git a/vignettes/articles/tbl_summary.Rmd b/vignettes/articles/tbl_summary.Rmd index 915b4df29..b6762258c 100644 --- a/vignettes/articles/tbl_summary.Rmd +++ b/vignettes/articles/tbl_summary.Rmd @@ -214,7 +214,8 @@ The {gtsummary} package comes with functions specifically made to modify and for dplyr::tribble( ~Function, ~Description, "`modify_header()`", "update column headers", - "`modify_footnote()`", "update column footnote", + "`modify_footnote_header()`", "update column header footnote", + "`modify_footnote_body()`", "update table body footnote", "`modify_spanning_header()`", "update spanning headers", "`modify_caption()`", "update table caption/title", "`bold_labels()`", "bold variable labels", @@ -238,9 +239,7 @@ trial2 |> add_n() |> modify_header(label ~ "**Variable**") |> modify_spanning_header(c("stat_1", "stat_2") ~ "**Treatment Received**") |> - modify_footnote( - all_stat_cols() ~ "Median (IQR) or Frequency (%)" - ) |> + modify_footnote_header("Median (IQR) or Frequency (%)", columns = all_stat_cols()) |> modify_caption("**Table 1. Patient Characteristics**") |> bold_labels() ```