Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed Dec 6, 2024
1 parent a7d6a80 commit f4f79bd
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
1 change: 1 addition & 0 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ reference:
- subtitle: Style Summary Tables
- contents:
- modify
- modify_footnote2
- modify_source_note
- modify_caption
- bold_italicize_labels_levels
Expand Down
7 changes: 3 additions & 4 deletions tests/testthat/test-as_hux_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 3 additions & 5 deletions tests/testthat/test-as_kable_extra.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-tbl_custom_summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions vignettes/articles/gallery.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
```

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

<hr>
Expand Down
3 changes: 2 additions & 1 deletion vignettes/articles/tbl_regression.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 3 additions & 4 deletions vignettes/articles/tbl_summary.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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()
```
Expand Down

0 comments on commit f4f79bd

Please sign in to comment.