You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The table is currently being printed with kable (aka a markdown table), if my memory is correct. I want to update this to be a {cli} print that is more beautiful, highlighting the parts that are most important, useful for users.
I also want to print the stats that are available to dynamically include in the headers (see example below), along with their types.
library(gtsummary)
packageVersion("gtsummary")
#> [1] '1.7.2'tbl<- tbl_summary(
trial,
by=trt,
include=age
) |>
add_overall()
show_header_names(tbl)
#> ℹ As a usage guide, the code below re-creates the current column headers.#> modify_header(#> label = '**Characteristic**',#> stat_0 = '**Overall**, N = 200',#> stat_1 = '**Drug A**, N = 98',#> stat_2 = '**Drug B**, N = 102'#> )#> #> #> Column Name Column Header #> ------------ ---------------------#> label **Characteristic** #> stat_0 **Overall**, N = 200 #> stat_1 **Drug A**, N = 98 #> stat_2 **Drug B**, N = 102# i also want to be able to display what stats are available to report in the headers# AND the type (e.g. <int>, <dbl>, <chr>, etc.)tbl$table_styling$header|>dplyr::select(column, label, starts_with("modify_stat_")) |>dplyr::rename_with(.fn=~gsub("^modify_stat_", "", .x))
#> # A tibble: 8 × 6#> column label N n p level #> <chr> <chr> <int> <int> <dbl> <chr> #> 1 variable variable 200 NA NA <NA> #> 2 var_type var_type 200 NA NA <NA> #> 3 var_label var_label 200 NA NA <NA> #> 4 row_type row_type 200 NA NA <NA> #> 5 label **Characteristic** 200 NA NA <NA> #> 6 stat_0 **Overall**, N = 200 200 200 1 Overall#> 7 stat_1 **Drug A**, N = 98 200 98 0.49 Drug A #> 8 stat_2 **Drug B**, N = 102 200 102 0.51 Drug B
Hey hey! FYI I added a small snapshot for show_header_names() just to be done with the existing function. I wanted to be done just in case we don't get this update into this release.
I noticed that we don't handle line breaks in the header cells well. So we should probably strip those and replace them with a space. I think I have a function that does this in as_kable().
include_example
argument?Created on 2024-05-30 with reprex v2.1.0
The text was updated successfully, but these errors were encountered: