diff --git a/dev/articles/gallery.html b/dev/articles/gallery.html index 8bc0ae1df..8c9ab28c6 100644 --- a/dev/articles/gallery.html +++ b/dev/articles/gallery.html @@ -7590,8 +7590,11 @@

Regression Tablesdplyr::bind_cols( broom::tidy(x, exponentiate = exponentiate, conf.int = FALSE), # calculate the confidence intervals, and save them in a tibble - confint.default(x) |> - dplyr::as_tibble() |> + dplyr::case_when( + exponentiate ~ exp(confint.default(x)), + .default = confint.default(x) + ) |> + dplyr::as_tibble(.name_repair = "minimal") |> rlang::set_names(c("conf.low", "conf.high")) ) } diff --git a/dev/pkgdown.yml b/dev/pkgdown.yml index ecdb38228..f8a435f10 100644 --- a/dev/pkgdown.yml +++ b/dev/pkgdown.yml @@ -10,7 +10,7 @@ articles: articles/tbl_regression: tbl_regression.html articles/tbl_summary: tbl_summary.html articles/themes: themes.html -last_built: 2024-12-13T03:39Z +last_built: 2024-12-17T19:45Z urls: reference: https://www.danieldsjoberg.com/gtsummary/reference article: https://www.danieldsjoberg.com/gtsummary/articles diff --git a/dev/reference/as_flex_table.html b/dev/reference/as_flex_table.html index d51a5c85a..e4f47be21 100644 --- a/dev/reference/as_flex_table.html +++ b/dev/reference/as_flex_table.html @@ -116,7 +116,7 @@

Examples tbl_summary(by = trt) |> add_p() |> as_flex_table() -

Characteristic

Drug A
N = 981

Drug B
N = 1021

p-value2

Age

46 (37, 60)

48 (39, 56)

0.7

Unknown

7

4

Grade

0.9

I

35 (36%)

33 (32%)

II

32 (33%)

36 (35%)

III

31 (32%)

33 (32%)

1Median (Q1, Q3); n (%)

2Wilcoxon rank sum test; Pearson's Chi-squared test

+

Characteristic

Drug A
N = 981

Drug B
N = 1021

p-value2

Age

46 (37, 60)

48 (39, 56)

0.7

Unknown

7

4

Grade

0.9

I

35 (36%)

33 (32%)

II

32 (33%)

36 (35%)

III

31 (32%)

33 (32%)

1Median (Q1, Q3); n (%)

2Wilcoxon rank sum test; Pearson's Chi-squared test

diff --git a/dev/reference/assign_summary_digits.html b/dev/reference/assign_summary_digits.html index cdd61e7f4..ffd44e0c6 100644 --- a/dev/reference/assign_summary_digits.html +++ b/dev/reference/assign_summary_digits.html @@ -98,43 +98,43 @@

Examples#> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) -#> <bytecode: 0x55f3a26eb648> -#> <environment: 0x55f3a5747da0> +#> <bytecode: 0x56440354b338> +#> <environment: 0x564401c6a190> #> #> $mpg$N_obs #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) -#> <bytecode: 0x55f3a26eb648> -#> <environment: 0x55f3a93f3680> +#> <bytecode: 0x56440354b338> +#> <environment: 0x564401cf2908> #> #> $mpg$N_miss #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) -#> <bytecode: 0x55f3a26eb648> -#> <environment: 0x55f3a93f3680> +#> <bytecode: 0x56440354b338> +#> <environment: 0x564401cf2908> #> #> $mpg$N_nonmiss #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) -#> <bytecode: 0x55f3a26eb648> -#> <environment: 0x55f3a93f3680> +#> <bytecode: 0x56440354b338> +#> <environment: 0x564401cf2908> #> #> $mpg$p_miss #> function (x) #> style_percent(x, prefix = prefix, suffix = suffix, digits = digits, #> big.mark = big.mark, decimal.mark = decimal.mark, ...) -#> <bytecode: 0x55f3a26f0998> -#> <environment: 0x55f3a8af8be8> +#> <bytecode: 0x5644035506c0> +#> <environment: 0x564401cefac0> #> #> $mpg$p_nonmiss #> function (x) #> style_percent(x, prefix = prefix, suffix = suffix, digits = digits, #> big.mark = big.mark, decimal.mark = decimal.mark, ...) -#> <bytecode: 0x55f3a26f0998> -#> <environment: 0x55f3a8af8be8> +#> <bytecode: 0x5644035506c0> +#> <environment: 0x564401cefac0> #> #> diff --git a/dev/reference/assign_tests.html b/dev/reference/assign_tests.html index b08bbeea6..8d5bbd866 100644 --- a/dev/reference/assign_tests.html +++ b/dev/reference/assign_tests.html @@ -168,7 +168,7 @@

Examples#> "method" & .data$stat %in% "Wilcoxon rank sum test with continuity correction" ~ #> list("Wilcoxon rank sum test"), .default = .data$stat)) #> } -#> <bytecode: 0x55f3a222f468> +#> <bytecode: 0x5644033fc2f0> #> <environment: namespace:gtsummary> #> attr(,"test_name") #> [1] "wilcox.test" @@ -179,7 +179,7 @@

Examples#> add_p_test_chisq.test(data = data, variable = variable, by = by, #> test.args = c(list(correct = FALSE), test.args), ...) #> } -#> <bytecode: 0x55f3a980aff0> +#> <bytecode: 0x56440ad68ca0> #> <environment: namespace:gtsummary> #> attr(,"test_name") #> [1] "chisq.test.no.correct" diff --git a/dev/reference/glance_fun_s3.html b/dev/reference/glance_fun_s3.html index dc92f35e6..13a7cb889 100644 --- a/dev/reference/glance_fun_s3.html +++ b/dev/reference/glance_fun_s3.html @@ -92,7 +92,7 @@

Examples#> { #> UseMethod("glance") #> } -#> <bytecode: 0x55f3a38679b0> +#> <bytecode: 0x564404702030> #> <environment: namespace:generics> diff --git a/dev/search.json b/dev/search.json index 3c2f35ebf..4a3c65146 100644 --- a/dev/search.json +++ b/dev/search.json @@ -1 +1 @@ -[{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CODE_OF_CONDUCT.html","id":null,"dir":"","previous_headings":"","what":"Contributor Code of Conduct","title":"Contributor Code of Conduct","text":"contributors maintainers project, pledge respect people contribute reporting issues, posting feature requests, updating documentation, submitting pull requests patches, activities. committed making participation project harassment-free experience everyone, regardless level experience, gender, gender identity expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion. Examples unacceptable behavior participants include use sexual language imagery, derogatory comments personal attacks, trolling, public private harassment, insults, unprofessional conduct. Project maintainers right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct. Project maintainers follow Code Conduct may removed project team. Instances abusive, harassing, otherwise unacceptable behavior may reported opening issue contacting one project maintainers. Code Conduct adapted Contributor Covenant (https://www.contributor-covenant.org), version 1.0.0, available https://contributor-covenant.org/version/1/0/0/.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to gtsummary","title":"Contributing to gtsummary","text":"outlines propose change gtsummary.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to gtsummary","text":"Small typos grammatical errors documentation may edited directly using GitHub web interface, long changes made source file. YES: edit roxygen comment .R file R/. : edit .Rd file man/.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":"prerequisites","dir":"","previous_headings":"","what":"Prerequisites","title":"Contributing to gtsummary","text":"make substantial pull request, always file issue make sure someone team agrees ’s problem. ’ve found bug, create associated issue illustrate bug minimal reprex.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"","what":"Pull request process","title":"Contributing to gtsummary","text":"recommend create Git branch pull request (PR). Look Travis AppVeyor build status making changes. README contain badges continuous integration services used package. New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat. Contributions test cases included easier accept. user-facing changes, add bullet top NEWS.md current development version header describing changes made followed GitHub username, links relevant issue(s)/PR(s).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to gtsummary","text":"Please note gtsummary project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 gts2 authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with gtsummary","title":"Getting help with gtsummary","text":"Thanks using gtsummary. filing issue, places explore pieces put together make process smooth possible. Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed. Thanks help!","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gallery.html","id":"data-summary-tables","dir":"Articles","previous_headings":"Frequently Asked Questions","what":"Data Summary Tables","title":"FAQ + Gallery","text":"Headers, Labels Formatting modify column headers table? change value levels? added spanning header row table? change variable labels? italicize bold labels table? italicize bold levels table? reduce font size cell padding table? Adding Modifying Statistics add number observations summary table? show additional summary statistics new row? include column missing values grouping variable? add column confidence around mean? add column difference groups? summarize continuous variable one, two () categorical variables? stratify summary table one variable? change p-values format? add p-value group compared single reference group? add correction multiple testing? combine summary table regression table? Statistical Tests paired t-test McNemar’s test?","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gallery.html","id":"regression-tables","dir":"Articles","previous_headings":"Frequently Asked Questions","what":"Regression Tables","title":"FAQ + Gallery","text":"Headers, Labels Formatting change text footnote? add significance stars low p-values? reduce font size cell padding table? Creating Combining Tables combine results two related regression models one table? combine regression table summary table? create regression table multiple models covariate(s) different outcomes? Adding Modifying Statistics add total event numbers regression table? add event numbers level categorical covariate? format Wald confidence interval?","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gallery.html","id":"summary-tables","dir":"Articles","previous_headings":"","what":"Summary Tables","title":"FAQ + Gallery","text":"Add spanning header group columns increased clarity, modify column headers. Using bold_labels() formats labels bold, labels can also italicized using italicize_labels(), combined format bold italics. Show continuous summary statistics multiple lines. Levels italicized using italicize_levels() function, bold_levels() function can used instead create bold text, functions can used together get text bold italics. Modify function formats p-values, change variable labels, updating tumor response header, add correction multiple testing. Include missing tumor response column using forcats::fct_na_value_to_level(). Report treatment differences two groups. often needed randomized trials. example, report difference tumor response marker level two chemotherapy treatments. Paired t-test McNemar’s test. data expected long format 2 rows per participant. Include p-values comparing groups single reference group. Add 95% confidence interval around mean additional column ’s often needed summarize continuous variable one, two, categorical variables. example shows table summarizing continuous variable two categorical variables. summarize two categorical variables, use tbl_continuous conjunction tbl_strata (see example tbl_strata ). Build summary table stratified one variable.","code":"trial |> tbl_summary( by = trt, include = c(age, grade), missing = \"no\", statistic = all_continuous() ~ \"{median} ({p25}, {p75})\" ) |> modify_header(all_stat_cols() ~ \"**{level}** \\nN = {n} ({style_percent(p)}%)\") |> add_n() |> bold_labels() |> modify_spanning_header(all_stat_cols() ~ \"**Chemotherapy Treatment**\") trial |> tbl_summary( by = trt, include = c(age, marker), type = all_continuous() ~ \"continuous2\", statistic = all_continuous() ~ c(\"{N_nonmiss}\", \"{mean} ({sd})\", \"{median} ({p25}, {p75})\", \"{min}, {max}\"), missing = \"no\" ) |> italicize_levels() trial |> mutate(response = factor(response, labels = c(\"No Tumor Response\", \"Tumor Responded\"))) |> tbl_summary( by = response, include = c(age, grade), missing = \"no\", label = list(age ~ \"Patient Age\", grade ~ \"Tumor Grade\") ) |> add_p(pvalue_fun = label_style_pvalue(digits = 2)) |> add_q() trial |> mutate( response = factor(response, labels = c(\"No Tumor Response\", \"Tumor Responded\")) |> forcats::fct_na_value_to_level(level = \"Missing Response Status\") ) |> tbl_summary( by = response, include = c(age, grade), label = list(age ~ \"Patient Age\", grade ~ \"Tumor Grade\") ) trial |> tbl_summary( by = trt, include = c(response, marker), statistic = list( all_continuous() ~ \"{mean} ({sd})\", all_categorical() ~ \"{p}%\" ), missing = \"no\" ) |> add_difference() |> add_n() |> modify_header(all_stat_cols() ~ \"**{level}**\") # imagine that each patient received Drug A and Drug B (adding ID showing their paired measurements) trial_paired <- trial |> select(trt, marker, response) |> mutate(.by = trt, id = dplyr::row_number()) # you must first delete incomplete pairs from the data, then you can build the table trial_paired |> # delete missing values tidyr::drop_na() |> # keep IDs with both measurements dplyr::filter(.by = id, dplyr::n() == 2) |> # summarize data tbl_summary(by = trt, include = -id) |> add_p( test = list(marker ~ \"paired.t.test\", response ~ \"mcnemar.test\"), group = id ) # table summarizing data with no p-values small_trial <- trial |> select(grade, age, response) t0 <- small_trial |> tbl_summary(by = grade, missing = \"no\") |> modify_header(all_stat_cols() ~ \"**{level}**\") # table comparing grade I and II t1 <- small_trial |> dplyr::filter(grade %in% c(\"I\", \"II\")) |> tbl_summary(by = grade, missing = \"no\") |> add_p() |> modify_header(p.value ~ \"**I vs. II**\") |> # hide summary stat columns modify_column_hide(all_stat_cols()) # table comparing grade I and II t2 <- small_trial |> dplyr::filter(grade %in% c(\"I\", \"III\")) |> tbl_summary(by = grade, missing = \"no\") |> add_p() |> modify_header(p.value = \"**I vs. III**\") |> # hide summary stat columns modify_column_hide(all_stat_cols()) # merging the 3 tables together, and adding additional gt formatting tbl_merge(list(t0, t1, t2)) |> modify_spanning_header( all_stat_cols() ~ \"**Tumor Grade**\", starts_with(\"p.value\") ~ \"**p-values**\" ) trial |> tbl_summary( include = c(age, marker), statistic = all_continuous() ~ \"{mean} ({sd})\", missing = \"no\" ) |> modify_header(stat_0 = \"**Mean (SD)**\") |> remove_footnote_header(stat_0) |> add_ci() trial |> tbl_continuous(variable = marker, by = trt, include = grade) |> modify_spanning_header(all_stat_cols() ~ \"**Treatment Assignment**\") trial |> select(trt, grade, age, stage) |> mutate(grade = paste(\"Grade\", grade)) |> tbl_strata( strata = grade, ~ .x |> tbl_summary(by = trt, missing = \"no\") |> modify_header(all_stat_cols() ~ \"**{level}**\") )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gallery.html","id":"regression-tables-1","dir":"Articles","previous_headings":"","what":"Regression Tables","title":"FAQ + Gallery","text":"Include number observations number events univariate regression table. Include two related models side--side descriptive statistics. also use compact table theme reduces cell padding font size. Include number events level categorical predictor. Regression model covariate remains , outcome changes. Implement custom tidier report Wald confidence intervals. Wald confidence intervals calculated using confint.default(). Use significance stars estimates low p-values.","code":"trial |> tbl_uvregression( method = glm, y = response, include = c(age, grade), method.args = list(family = binomial), exponentiate = TRUE ) |> add_nevent() gt_r1 <- glm(response ~ trt + grade, trial, family = binomial) |> tbl_regression(exponentiate = TRUE) gt_r2 <- survival::coxph(survival::Surv(ttdeath, death) ~ trt + grade, trial) |> tbl_regression(exponentiate = TRUE) gt_t1 <- trial |> tbl_summary(include = c(trt, grade), missing = \"no\") |> add_n() |> modify_header(stat_0 = \"**n (%)**\") |> remove_footnote_header(stat_0) theme_gtsummary_compact() #> Setting theme \"Compact\" tbl_merge( list(gt_t1, gt_r1, gt_r2), tab_spanner = c(NA_character_, \"**Tumor Response**\", \"**Time to Death**\") ) trial |> tbl_uvregression( method = survival::coxph, y = survival::Surv(ttdeath, death), include = c(stage, grade), exponentiate = TRUE, hide_n = TRUE ) |> add_nevent(location = \"level\") trial |> tbl_uvregression( method = lm, x = trt, show_single_row = \"trt\", hide_n = TRUE, include = c(age, marker) ) |> modify_header(label = \"**Model Outcome**\", estimate = \"**Treatment Coef.**\") |> modify_footnote_header(\"Values larger than 0 indicate larger values in the Drug B group.\", columns = estimate) my_tidy <- function(x, exponentiate = FALSE, conf.level = 0.95, ...) { dplyr::bind_cols( broom::tidy(x, exponentiate = exponentiate, conf.int = FALSE), # calculate the confidence intervals, and save them in a tibble confint.default(x) |> dplyr::as_tibble() |> rlang::set_names(c(\"conf.low\", \"conf.high\")) ) } lm(age ~ grade + marker, trial) |> tbl_regression(tidy_fun = my_tidy) trial |> tbl_uvregression( method = survival::coxph, y = survival::Surv(ttdeath, death), include = c(stage, grade), exponentiate = TRUE, ) |> add_significance_stars()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Definition of a gtsummary Object","text":"Every {gtsummary} table characteristics common among tables created package. , review characteristics, provide instructions construct {gtsummary} object.","code":"library(gtsummary) tbl_regression_ex <- lm(age ~ grade + marker, trial) |> tbl_regression() |> bold_p(t = 0.5) tbl_summary_ex <- trial |> tbl_summary(by = trt, include = c(trt, age, grade, response))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"structure-of-a-gtsummary-object","dir":"Articles","previous_headings":"","what":"Structure of a {gtsummary} object","title":"Definition of a gtsummary Object","text":"Every {gtsummary} object list comprising , minimum, elements:","code":".$table_body .$table_styling"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"table_body","dir":"Articles","previous_headings":"Structure of a {gtsummary} object","what":"table_body","title":"Definition of a gtsummary Object","text":".$table_body object data frame ultimately printed output. table must include columns \"label\", \"row_type\", \"variable\". \"label\" column printed, two hidden final output.","code":"tbl_summary_ex$table_body #> # A tibble: 8 × 7 #> variable var_type row_type var_label label stat_1 stat_2 #> #> 1 age continuous label Age Age 46 (37, 60) 48 (3… #> 2 age continuous missing Age Unknown 7 4 #> 3 grade categorical label Grade Grade NA NA #> 4 grade categorical level Grade I 35 (36%) 33 (3… #> 5 grade categorical level Grade II 32 (33%) 36 (3… #> 6 grade categorical level Grade III 31 (32%) 33 (3… #> 7 response dichotomous label Tumor Response Tumor Response 28 (29%) 33 (3… #> 8 response dichotomous missing Tumor Response Unknown 3 4"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"table_styling","dir":"Articles","previous_headings":"Structure of a {gtsummary} object","what":"table_styling","title":"Definition of a gtsummary Object","text":".$table_styling object list data frames containing information .$table_body printed, formatted, styled. list contains following data frames header, footnote_header, footnote_body, abbreviation, source_note, fmt_fun, text_format, fmt_missing, cols_merge following objects caption horizontal_line_above. header header table following columns one row per column found .$table_body. table contains styling information applies entire column columns headers. footnote_header {gtsummary} table may contain footnotes column headers. Updates/changes footnote appended bottom tibble. footnote_body {gtsummary} table may include footnotes body table. Updates/changes footnote appended bottom tibble. abbreviation Abbreviations added one time, time table rendering, coalesced single source note. source_note tibble source notes include. source note assigned ID based order added table. Source notes added one time present much like footnotes, linked header cell table. fmt_fun Numeric columns/rows styled functions stored fmt_fun. Updates/changes styling functions appended bottom tibble. text_format Columns/rows styled bold, italic, indenting stored text_format. Updates/changes styling functions appended bottom tibble. fmt_missing default, NA values shown blanks. Missing values columns/rows replaced symbol. example, reference rows tbl_regression() shown em-dash. Updates/changes styling functions appended bottom tibble. cols_merge object experimental may change future. tibble gives instructions merging columns single column. implementation as_gt() updated gt::cols_label() gains rows= argument. caption String made table caption. attribute \"text_interpret\" either c(\"md\", \"html\"). horizontal_line_above Expression identifying row horizontal line placed table. Example tbl_regression()","code":"tbl_regression_ex$table_styling #> $header #> # A tibble: 24 × 8 #> column hide align interpret_label label interpret_spanning_h…¹ #> #> 1 variable TRUE center gt::md varia… gt::md #> 2 var_label TRUE center gt::md var_l… gt::md #> 3 var_type TRUE center gt::md var_t… gt::md #> 4 reference_row TRUE center gt::md refer… gt::md #> 5 row_type TRUE center gt::md row_t… gt::md #> 6 header_row TRUE center gt::md heade… gt::md #> 7 N_obs TRUE center gt::md N_obs gt::md #> 8 N TRUE center gt::md **N** gt::md #> 9 coefficients_type TRUE center gt::md coeff… gt::md #> 10 coefficients_label TRUE center gt::md coeff… gt::md #> # ℹ 14 more rows #> # ℹ abbreviated name: ¹​interpret_spanning_header #> # ℹ 2 more variables: spanning_header , modify_stat_N #> #> $footnote_header #> # A tibble: 0 × 5 #> # ℹ 5 variables: column , footnote , text_interpret , #> # replace , remove #> #> $footnote_body #> # A tibble: 0 × 6 #> # ℹ 6 variables: column , rows , footnote , #> # text_interpret , replace , remove #> #> $abbreviation #> # A tibble: 2 × 3 #> column abbreviation text_interpret #> #> 1 conf.low CI = Confidence Interval gt::md #> 2 std.error SE = Standard Error gt::md #> #> $source_note #> # A tibble: 0 × 4 #> # ℹ 4 variables: id , source_note , text_interpret , #> # remove #> #> $text_format #> # A tibble: 1 × 4 #> column rows format_type undo_text_format #> #> 1 p.value bold FALSE #> #> $indent #> # A tibble: 2 × 3 #> column rows n_spaces #> #> 1 label 0 #> 2 label 4 #> #> $fmt_missing #> # A tibble: 4 × 3 #> column rows symbol #> #> 1 estimate — #> 2 conf.low — #> 3 std.error — #> 4 statistic — #> #> $fmt_fun #> # A tibble: 10 × 3 #> column rows fmt_fun #> #> 1 estimate #> 2 N #> 3 N_obs #> 4 n_obs #> 5 conf.low #> 6 conf.high #> 7 p.value #> 8 std.error #> 9 statistic #> 10 var_nlevels #> #> $cols_merge #> # A tibble: 1 × 3 #> column rows pattern #> #> 1 conf.low {conf.low}, {conf.high}"},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"table_body-1","dir":"Articles","previous_headings":"Constructing a {gtsummary} object","what":"table_body","title":"Definition of a gtsummary Object","text":"constructing {gtsummary} object, author begin .$table_body object. Recall .$table_body data frame must include columns \"label\", \"row_type\", \"variable\". columns, \"label\" column printed final results. \"row_type\" column typically control whether label column indented. \"variable\" column often used inline_text() family functions, merging {gtsummary} tables tbl_merge(). columns .$table_body created user likely printed output. Formatting printing instructions columns stored .$table_styling.","code":"tbl_regression_ex %>% getElement(\"table_body\") %>% select(variable, row_type, label) #> # A tibble: 5 × 3 #> variable row_type label #> #> 1 grade label Grade #> 2 grade level I #> 3 grade level II #> 4 grade level III #> 5 marker label Marker Level (ng/mL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"table_styling-1","dir":"Articles","previous_headings":"Constructing a {gtsummary} object","what":"table_styling","title":"Definition of a gtsummary Object","text":"internal {gtsummary} functions assist constructing modifying .$table_header data frame. .create_gtsummary_object(table_body) user creates table_body, pass function skeleton gtsummary object created returned (including full table_styling list tables). .update_table_styling() columns added removed table_body, run function update .$table_styling include remove styling instructions columns. FYI default styling new column hide . modify_table_styling() exported function modifies printing instructions single column groups columns. modify_table_body() exported function helps users make changes .$table_body. function runs .update_table_styling() internally maintain internal validity printing instructions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"printing-a-gtsummary-object","dir":"Articles","previous_headings":"","what":"Printing a {gtsummary} object","title":"Definition of a gtsummary Object","text":"{gtsummary} objects printed print.gtsummary(). {gtsummary} object printed, converted {gt} object using as_gt(). function takes {gtsummary} object input, uses information .$table_styling construct list {gt} calls executed .$table_body. {gtsummary} object converted {gt}, printed {gt} object. cases, package defaults printing engines, flextable (as_flex_table()), huxtable (as_hux_table()), kableExtra (as_kable_extra()), kable (as_kable()). default print engine set theme element \"pkgwide-str:print_engine\" actual print function slightly involved, basically :","code":"print.gtsummary <- function(x) { get_theme_element(\"pkgwide-str:print_engine\") %>% switch( \"gt\" = as_gt(x), \"flextable\" = as_flex_table(x), \"huxtable\" = as_hux_table(x), \"kable_extra\" = as_kable_extra(x), \"kable\" = as_kable(x) ) %>% print() }"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"the--cards-object","dir":"Articles","previous_headings":"","what":"The .$cards object","title":"Definition of a gtsummary Object","text":"gtsummary function called requires new statistics, new calculations stored tibble. tibbles often calculated functions {cards} {cardx} packages. structured tibbles store labels statistics, functions format , . See {cards} package documentation details.","code":"tbl_summary_ex$cards[[\"tbl_summary\"]] #> {cards} data frame: 76 x 12 #> group1 group1_level variable variable_level stat_name stat_label stat #> 1 trt Drug A grade I n n 35 #> 2 trt Drug A grade I N N 98 #> 3 trt Drug A grade I p % 0.357 #> 4 trt Drug B grade I n n 33 #> 5 trt Drug B grade I N N 102 #> 6 trt Drug B grade I p % 0.324 #> 7 trt Drug A grade II n n 32 #> 8 trt Drug A grade II N N 98 #> 9 trt Drug A grade II p % 0.327 #> 10 trt Drug B grade II n n 36 #> ℹ 66 more rows #> ℹ Use `print(n = ...)` to see more rows #> ℹ 5 more variables: context, fmt_fn, warning, error, gts_column"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"inline_text() tutorial","text":"Reproducible reports important part good practices. often need report results table text R markdown report. Inline reporting made simple inline_text(). inline_text() function reports statistics {gtsummary} tables inline R markdown report.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"inline_text() tutorial","text":"going tutorial, install load {gtsummary}.","code":"# install.packages(\"gtsummary\") library(gtsummary)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"example-data-set","dir":"Articles","previous_headings":"","what":"Example data set","title":"inline_text() tutorial","text":"’ll using trial data set throughout example. set contains data 200 patients received one two types chemotherapy (Drug Drug B). outcomes tumor response death. brevity tutorial, let’s keep subset variables trial data set.","code":"trial2 <- trial %>% select(trt, marker, stage)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"inline_text_tbl_summary","dir":"Articles","previous_headings":"","what":"Inline results from tbl_summary()","title":"inline_text() tutorial","text":"First create basic summary table using tbl_summary() (review tbl_summary() vignette detailed overview function needed). report median (IQR) marker levels group, use following commands inline. median (IQR) marker level Drug Drug B groups `r inline_text(tab1, variable = marker, column = \"Drug \")` `r inline_text(tab1, variable = marker, column = \"Drug B\")`, respectively. ’s line appear report. median (IQR) marker level Drug Drug B groups 0.84 (0.23, 1.60) 0.52 (0.18, 1.21), respectively. display statistic categorical variable, include level argument. `r inline_text(tab1, variable = stage, level = \"T1\", column = \"Drug B\")` resolves “25 (25%)”","code":"tab1 <- tbl_summary(trial2, by = trt) tab1"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"inline_text_tbl_regression","dir":"Articles","previous_headings":"","what":"Inline results from tbl_regression()","title":"inline_text() tutorial","text":"Similar syntax used report results tbl_regression() tbl_uvregression() tables. Refer tbl_regression() vignette need detailed guidance using functions. Let’s first create regression model. Now summarize results tbl_regression(); exponentiate get odds ratios. report result age, use following commands inline. `r inline_text(tbl_m1, variable = age)` ’s line appear report. 1.02 (95% CI 1.00, 1.04; p=0.091) reasonable ’ll need modify text. , use pattern argument. pattern argument syntax follows glue::glue() format referenced R objects inserted curly brackets. default pattern = \"{estimate} ({conf.level*100}% CI {conf.low}, {conf.high}; {p.value})\". access following fields within pattern argument. Age significantly associated tumor response `r inline_text(tbl_m1, variable = age, pattern = \"({estimate}; 95% CI {conf.low}, {conf.high}; {p.value})\")`. Age significantly associated tumor response (1.02; 95% CI 1.00, 1.04; p=0.091). ’re printing results categorical variable, include level argument, e.g. inline_text(tbl_m1, variable = stage, level = \"T3\") resolves “0.94 (95% CI 0.39, 2.28; p=0.9)”. inline_text function arguments rounding p-value (pvalue_fun) coefficients confidence interval (estimate_fun). default rounding performed table, can modified reporting inline. details inline code, review RStudio documentation page.","code":"# build logistic regression model m1 <- glm(response ~ age + stage, trial, family = binomial(link = \"logit\")) tbl_m1 <- tbl_regression(m1, exponentiate = TRUE) tbl_m1"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"output-types","dir":"Articles","previous_headings":"","what":"Output Types","title":"gtsummary + Quarto/Rmarkdown","text":"’s summary various Quarto R Markdown output types print engines support . {gtsummary} table can converted one types table . example, code prints {gtsummary} table {flextable} table, instead default {gt} table.","code":"tbl_summary(trial) %>% as_flex_table()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"example-r-markdown-report","dir":"Articles","previous_headings":"","what":"Example R Markdown Report","title":"gtsummary + Quarto/Rmarkdown","text":"example R markdown report using {gtsummary} included package. open example file, run following command R console.","code":"library(gtsummary) system.file(package = \"gtsummary\") %>% file.path(\"rmarkdown_example/gtsummary_rmarkdown_html.Rmd\") %>% file.edit()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"latex","dir":"Articles","previous_headings":"","what":"LaTeX","title":"gtsummary + Quarto/Rmarkdown","text":"print {gtsummary} tables using LaTeX, utilize one supporting print engines.","code":"# build gtsummary table tbl <- tbl_summary(trial) # using the {gt} package as_gt(tbl) %>% gt::as_latex() # using the {huxtable} package as_hux_table(tbl) %>% huxtable::to_latex() # using the {kableExtra} package as_kable_extra(tbl, format = \"latex\") # using the knitr::kable function as_kable(tbl, format = \"latex\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"images","dir":"Articles","previous_headings":"","what":"Images","title":"gtsummary + Quarto/Rmarkdown","text":"Use {gt} package’s gt::gtsave() function save images {gtsummary} tables.","code":"tbl_summary(trial) |> # build gtsummary table as_gt() |> # convert to gt table gt::gtsave( # save table as image filename = \"my_table_image.png\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"tips","dir":"Articles","previous_headings":"","what":"Tips","title":"gtsummary + Quarto/Rmarkdown","text":"printing {gt} {gtsummary} tables loop, use print() results = 'asis' R markdown chunk. print(tbl) work , try either knitr::knit_print(tbl) cat(knitr::knit_print(tbl)). Icons icons8","code":"```{r loop_print, results = 'asis'} for (i in 1) { tbl <- tbl_summary(trial) # build gtsummary table print(tbl) # print table } ```"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/shiny.html","id":"shiny-example","dir":"Articles","previous_headings":"","what":"Shiny Example","title":"gtsummary + Shiny","text":"example Shiny app using gtsummary package provide dynamic patient characteristic summaries. Shiny app run free server usage, see instructions running app locally machine.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/shiny.html","id":"shiny-code","dir":"Articles","previous_headings":"","what":"Shiny Code","title":"gtsummary + Shiny","text":"run Shiny app locally machine, save script app.R R Project, open RStudio, run application.","code":"library(gtsummary) library(shiny) library(gt) # create the Shiny app ui <- fluidPage( # Inputs: Select Age Range sidebarPanel( sliderInput( inputId = \"age_range\", label = \"Age Range\", min = 5, max = 85, value = c(5, 85), step = 5 ) ), # place summary table on main page gt_output(outputId = \"my_gt_table\") ) server <- function(input, output, session) { output$my_gt_table <- render_gt( trial %>% # filter out patients outside of age range dplyr::filter( dplyr::between(age, input$age_range[1], input$age_range[2]) ) %>% # build a gtsummary table tbl_summary( by = trt, type = age ~ \"continuous\", include = c(age, grade, response), missing = \"no\" ) %>% add_stat_label() %>% add_n() %>% # CONVERT TO A {gt} TABLE! VERY IMPORTANT STEP! as_gt() %>% tab_header(md(\"**Table 1. Patient Characteristics**\")) ) } # Run the application shinyApp(ui = ui, server = server)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"tbl_regression() tutorial","text":"tbl_regression() function takes regression model object R returns formatted table regression model results publication-ready. simple way summarize present analysis results using R! Like tbl_summary(), tbl_regression() creates highly customizable analytic tables sensible defaults. vignette walk reader tbl_regression() function, various functions available modify make additions existing formatted regression table. Behind scenes: tbl_regression() uses broom::tidy() perform initial model formatting, can accommodate many different model types (e.g. lm(), glm(), survival::coxph(), survival::survreg() others supported models known work {gtsummary}). also possible specify function tidy model results needed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"tbl_regression() tutorial","text":"going tutorial, install load {gtsummary}.","code":"# install.packages(\"gtsummary\") library(gtsummary)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"example-data-set","dir":"Articles","previous_headings":"","what":"Example data set","title":"tbl_regression() tutorial","text":"vignette ’ll using trial data set included {gtsummary} package. data set contains information 200 patients received one two types chemotherapy (Drug Drug B). outcomes tumor response death. variable data frame assigned attribute label (.e. attr(trial$trt, \"label\") == \"Chemotherapy Treatment\") labelled package, highly recommend using. labels displayed {gtsummary} output table default. Using {gtsummary} data frame without labels simply print variable names, option add labels later.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"basic-usage","dir":"Articles","previous_headings":"","what":"Basic Usage","title":"tbl_regression() tutorial","text":"default output tbl_regression() meant publication ready. Let’s start creating logistic regression model predict tumor response using variables age grade trial data set. regression model table summarize present results just one line code {gtsummary}. Note sensible defaults basic usage (can customized later): model recognized logistic regression coefficients exponentiated, header displayed “” odds ratio. Variable types automatically detected reference rows added categorical variables. Model estimates confidence intervals rounded formatted. variables data set labelled, labels carried {gtsummary} output table. data labelled, default display variable name. Variable levels indented footnotes added.","code":"# build logistic regression model m1 <- glm(response ~ age + stage, trial, family = binomial) # view raw model results summary(m1)$coefficients #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) -1.48622424 0.62022844 -2.3962530 0.01656365 #> age 0.01939109 0.01146813 1.6908683 0.09086195 #> stageT2 -0.54142643 0.44000267 -1.2305071 0.21850725 #> stageT3 -0.05953479 0.45042027 -0.1321761 0.89484501 #> stageT4 -0.23108633 0.44822835 -0.5155549 0.60616530 tbl_regression(m1, exponentiate = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"customize-output","dir":"Articles","previous_headings":"","what":"Customize Output","title":"tbl_regression() tutorial","text":"four primary ways customize output regression model table. Modify tbl_regression() function input arguments Add additional data/information summary table add_*() functions Modify summary table appearance {gtsummary} functions Modify table appearance {gt} package functions","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"modifying-function-arguments","dir":"Articles","previous_headings":"Customize Output","what":"Modifying function arguments","title":"tbl_regression() tutorial","text":"tbl_regression() function includes many arguments modifying appearance.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"gtsummary-functions-to-add-information","dir":"Articles","previous_headings":"Customize Output","what":"{gtsummary} functions to add information","title":"tbl_regression() tutorial","text":"{gtsummary} package built-functions adding results tbl_regression(). following functions add columns /information regression table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"gtsummary-functions-to-format-table","dir":"Articles","previous_headings":"Customize Output","what":"{gtsummary} functions to format table","title":"tbl_regression() tutorial","text":"{gtsummary} package comes functions specifically made modify format summary tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"gt-functions-to-format-table","dir":"Articles","previous_headings":"Customize Output","what":"{gt} functions to format table","title":"tbl_regression() tutorial","text":"{gt} package packed many great functions modifying table output—many list . Review package’s website full listing. use {gt} package functions {gtsummary} tables, regression table must first converted {gt} object. end, use as_gt() function modifications completed {gtsummary} functions.","code":"m1 |> tbl_regression(exponentiate = TRUE) |> as_gt() |> gt::tab_source_note(gt::md(\"*This data is simulated*\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"example","dir":"Articles","previous_headings":"Customize Output","what":"Example","title":"tbl_regression() tutorial","text":"formatting options available, adding bold italics text. example , - Coefficients exponentiated give odds ratios - Global p-values Stage reported - Large p-values rounded two decimal places - P-values less 0.10 bold - Variable labels bold - Variable levels italicized","code":"# format results into data frame with global p-values m1 |> tbl_regression( exponentiate = TRUE, pvalue_fun = label_style_pvalue(digits = 2), ) |> add_global_p() |> bold_p(t = 0.10) |> bold_labels() |> italicize_levels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"tbl_uvregression","dir":"Articles","previous_headings":"","what":"Univariate Regression","title":"tbl_regression() tutorial","text":"tbl_uvregression() function produces table univariate regression models. function wrapper tbl_regression(), result, accepts nearly identical function arguments. function’s results can modified similar ways tbl_regression().","code":"trial |> tbl_uvregression( method = glm, y = response, include = c(age, grade), method.args = list(family = binomial), exponentiate = TRUE, pvalue_fun = label_style_pvalue(digits = 2) ) |> add_global_p() |> # add global p-value add_nevent() |> # add number of events of the outcome add_q() |> # adjusts global p-values for multiple testing bold_p() |> # bold p-values under a given threshold (default 0.05) bold_p(t = 0.10, q = TRUE) |> # now bold q-values under the threshold of 0.10 bold_labels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"options","dir":"Articles","previous_headings":"","what":"Setting Default Options","title":"tbl_regression() tutorial","text":"{gtsummary} regression functions related functions sensible defaults rounding formatting results. , however, like change defaults options. default options can changed using {gtsummary} themes function set_gtsummary_theme(). package includes pre-specified themes, can also create . Themes can control baseline behavior, example, p-values rounded, coefficients rounded, default headers, confidence levels, etc. details creating theme setting personal defaults, visit themes vignette.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"supported-models","dir":"Articles","previous_headings":"","what":"Supported Models","title":"tbl_regression() tutorial","text":"listing known tested models supported tbl_regression(). model follows standard format tidier, ’s likely supported well, even listed .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"tbl_summary() tutorial","text":"tbl_summary() function calculates descriptive statistics continuous, categorical, dichotomous variables R, presents results beautiful, customizable summary table ready publication (example, Table 1 demographic tables). vignette walk reader tbl_summary() function, various functions available modify make additions existing table summary object.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"tbl_summary() tutorial","text":"going tutorial, install load {gtsummary}.","code":"# install.packages(\"gtsummary\") library(gtsummary)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"example-data-set","dir":"Articles","previous_headings":"","what":"Example data set","title":"tbl_summary() tutorial","text":"’ll using trial data set throughout example. set contains data 200 patients received one two types chemotherapy (Drug Drug B). outcomes tumor response death. variable data frame assigned attribute label (.e. attr(trial$trt, \"label\") == \"Chemotherapy Treatment\") labelled package. labels displayed {gtsummary} output table default. Using {gtsummary} data frame without labels simply print variable names place variable labels; also option add labels later. brevity, tutorial ’ll use subset variables trial data set.","code":"head(trial) #> # A tibble: 6 × 8 #> trt age marker stage grade response death ttdeath #> #> 1 Drug A 23 0.16 T1 II 0 0 24 #> 2 Drug B 9 1.11 T2 I 1 0 24 #> 3 Drug A 31 0.277 T1 II 0 0 24 #> 4 Drug A NA 2.07 T3 III 1 1 17.6 #> 5 Drug A 51 2.77 T4 III 1 1 16.4 #> 6 Drug B 39 0.613 T4 I 0 1 15.6 trial2 <- trial |> select(trt, age, grade)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"basic-usage","dir":"Articles","previous_headings":"","what":"Basic Usage","title":"tbl_summary() tutorial","text":"default output tbl_summary() meant publication ready. Let’s start creating table summary statistics trial data set. tbl_summary() function can take, minimum, data frame input, returns descriptive statistics column data frame. Note sensible defaults basic usage; defaults may customized. Variable types automatically detected appropriate descriptive statistics calculated. Label attributes data set automatically printed. Missing values listed “Unknown” table. Variable levels indented footnotes added. study data summary statistics split treatment group, can done using = argument. compare two groups, include add_p() function call, detects variable type uses appropriate statistical test.","code":"trial2 |> tbl_summary() trial2 |> tbl_summary(by = trt) |> add_p()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"customize-output","dir":"Articles","previous_headings":"","what":"Customize Output","title":"tbl_summary() tutorial","text":"four primary ways customize output summary table. Use tbl_summary() function arguments Add additional data/information summary table add_*() functions Modify summary table appearance {gtsummary} functions Modify table appearance {gt} package functions","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"modifying-tbl_summary-function-arguments","dir":"Articles","previous_headings":"Customize Output","what":"Modifying tbl_summary() function arguments","title":"tbl_summary() tutorial","text":"tbl_summary() function includes many input options modifying appearance. Example modifying tbl_summary() arguments. multiple ways specify statistic= argument using single formula, list formulas, named list. following table shows equivalent ways specify mean statistic continuous variables age marker. {gtsummary} function argument accepts formulas accept variations.","code":"trial2 |> tbl_summary( by = trt, statistic = list( all_continuous() ~ \"{mean} ({sd})\", all_categorical() ~ \"{n} / {N} ({p}%)\" ), digits = all_continuous() ~ 2, label = grade ~ \"Tumor Grade\", missing_text = \"(Missing)\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"gtsummary-functions-to-add-information","dir":"Articles","previous_headings":"Customize Output","what":"{gtsummary} functions to add information","title":"tbl_summary() tutorial","text":"{gtsummary} package functions adding information statistics tbl_summary() tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"gtsummary-functions-to-format-table","dir":"Articles","previous_headings":"Customize Output","what":"{gtsummary} functions to format table","title":"tbl_summary() tutorial","text":"{gtsummary} package comes functions specifically made modify format summary tables. Example adding tbl_summary()-family functions Table 1. Patient Characteristics","code":"trial2 |> tbl_summary(by = trt) |> add_p(pvalue_fun = label_style_pvalue(digits = 2)) |> add_overall() |> add_n() |> modify_header(label ~ \"**Variable**\") |> modify_spanning_header(c(\"stat_1\", \"stat_2\") ~ \"**Treatment Received**\") |> modify_footnote_header(\"Median (IQR) or Frequency (%)\", columns = all_stat_cols()) |> modify_caption(\"**Table 1. Patient Characteristics**\") |> bold_labels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"gt-functions-to-format-table","dir":"Articles","previous_headings":"Customize Output","what":"{gt} functions to format table","title":"tbl_summary() tutorial","text":"{gt} package packed many great functions modifying table output—many list . Review package’s website full listing. use {gt} package functions {gtsummary} tables, summary table must first converted gt object. end, use as_gt() function modifications completed {gtsummary} functions.","code":"trial2 |> tbl_summary(by = trt, missing = \"no\") |> add_n() |> as_gt() |> gt::tab_source_note(gt::md(\"*This data is simulated*\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"select_helpers","dir":"Articles","previous_headings":"","what":"Select Helpers","title":"tbl_summary() tutorial","text":"flexibility select variables {gtsummary} arguments, allows many customization opportunities! example, want show age marker levels one decimal place tbl_summary(), can pass digits = c(age, marker) ~ 1. selecting input flexible, may also pass quoted column names. Going beyond typing specific variables data set, can use: {tidyselect} helpers available throughout tidyverse, starts_with(), contains(), everything() (.e. anything can use dplyr::select() function), can used {gtsummary}. Additional {gtsummary} selectors included package supplement tidyselect functions. Summary type two primary ways select variables summary type. useful, example, wish report mean standard deviation continuous variables: statistic = all_continuous() ~ \"{mean} ({sd})\". Dichotomous variables , default, included all_categorical().","code":"all_continuous() all_categorical()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"continuous2","dir":"Articles","previous_headings":"","what":"Multi-line Continuous Summaries","title":"tbl_summary() tutorial","text":"Continuous variables may also summarized multiple lines—common format journals. update continuous variables summarize multiple lines, update summary type \"continuous2\" (summaries two lines).","code":"trial2 |> select(age, trt) |> tbl_summary( by = trt, type = all_continuous() ~ \"continuous2\", statistic = all_continuous() ~ c( \"{N_nonmiss}\", \"{median} ({p25}, {p75})\", \"{min}, {max}\" ), missing = \"no\" ) |> add_p(pvalue_fun = label_style_pvalue(digits = 2))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"advanced","dir":"Articles","previous_headings":"","what":"Advanced Customization","title":"tbl_summary() tutorial","text":"information section applies {gtsummary} objects. {gtsummary} table two important internal objects: print output tbl_summary() function R console R markdown document, .$table_body data frame formatted using instructions listed .$table_styling. default printer converts {gtsummary} object {gt} object as_gt() via sequence {gt} commands executed .$table_body. ’s example first calls saved tbl_summary(): {gt} functions called order appear, beginning gt::gt(). user want specific {gt} function run (.e. like change default printing), {gt} call can excluded as_gt() function. example , default alignment restored. as_gt() function run, additional formatting may added table using {gt} functions. example , source note added table.","code":"tbl_summary(trial2) |> as_gt(return_calls = TRUE) |> head(n = 4) #> $gt #> gt::gt(data = x$table_body, groupname_col = NULL, caption = NULL) #> #> $fmt_missing #> $fmt_missing[[1]] #> gt::sub_missing(columns = gt::everything(), missing_text = \"\") #> #> #> $cols_merge #> list() #> #> $cols_align #> $cols_align[[1]] #> gt::cols_align(columns = c(\"variable\", \"var_type\", \"row_type\", #> \"var_label\", \"stat_0\"), align = \"center\") #> #> $cols_align[[2]] #> gt::cols_align(columns = \"label\", align = \"left\") tbl_summary(trial2, by = trt) |> as_gt(include = -cols_align) |> gt::tab_source_note(gt::md(\"*This data is simulated*\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"options","dir":"Articles","previous_headings":"","what":"Set Default Options with Themes","title":"tbl_summary() tutorial","text":"{gtsummary} tbl_summary() function related functions sensible defaults rounding presenting results. , however, like change defaults options. default options can changed using {gtsummary} themes function set_gtsummary_theme(). package includes prespecified themes, can also create . Themes can control baseline behavior, example, p-values percentages rounded, statistics presented tbl_summary(), default statistical tests add_p(), etc. details creating theme setting personal defaults, review themes vignette.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"tbl_svysummary","dir":"Articles","previous_headings":"","what":"Survey Data","title":"tbl_summary() tutorial","text":"{gtsummary} package also supports survey data (objects created {survey} package) via tbl_svysummary() function. syntax tbl_svysummary() tbl_summary() nearly identical, examples apply survey summaries well. begin, install {survey} package load apiclus1 data set. begin, convert data frame survey object, registering ID weighting columns, setting finite population correction column. creating survey object, can now summarize similarly standard data frame using tbl_svysummary(). Like tbl_summary(), tbl_svysummary() accepts = argument works add_p() add_overall() functions. possible pass custom functions statistic= argument tbl_svysummary(). must use one pre-defined summary statistic functions (e.g. {mean}, {median}) leverage functions {survey} package calculate weighted statistics. tbl_svysummary() can also handle weighted survey data row represents several individuals:","code":"install.packages(\"survey\") # loading the api data set data(api, package = \"survey\") svy_apiclus1 <- survey::svydesign( id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc ) svy_apiclus1 |> tbl_svysummary( # stratify summary statistics by the \"both\" column by = both, # summarize a subset of the columns include = c(api00, api99, both), # adding labels to table label = list(api00 = \"API in 2000\", api99 = \"API in 1999\") ) |> add_p() |> # comparing values by \"both\" column add_overall() |> # adding spanning header modify_spanning_header(c(\"stat_1\", \"stat_2\") ~ \"**Met Both Targets**\") Titanic |> as_tibble() |> survey::svydesign(data = _, ids = ~1, weights = ~n) |> tbl_svysummary(include = c(Age, Survived))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"tbl_cross","dir":"Articles","previous_headings":"","what":"Cross Tables","title":"tbl_summary() tutorial","text":"Use tbl_cross() compare two categorical variables data. tbl_cross() wrapper tbl_summary() : Automatically adds spanning header table name label comparison variable. Uses percent = \"cell\" default. Adds row column margin totals (customizable margin argument). Displays missing data row column variables (customizable missing argument).","code":"trial |> tbl_cross( row = stage, col = trt, percent = \"cell\" ) |> add_p()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"setting-themes","dir":"Articles","previous_headings":"","what":"Setting Themes","title":"gtsummary themes","text":"set pre-defined theme, simply include theme function script R console. Use set_gtsummary_theme() function set user-defined themes (). Themes must set create {gtsummary} tables. Let’s take look default table, comparing data treatment groups.","code":"theme_gtsummary_journal(journal = \"jama\") set_gtsummary_theme(my_custom_theme)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"default-theme","dir":"Articles","previous_headings":"Setting Themes","what":"Default Theme","title":"gtsummary themes","text":"","code":"library(gtsummary) trial |> tbl_summary(by = trt, include = c(age, grade)) |> add_p()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"jama-theme","dir":"Articles","previous_headings":"Setting Themes","what":"JAMA Theme","title":"gtsummary themes","text":"Now, code JAMA theme. setting theme, able change default formatting p-value add dash 25th 75th percentiles.","code":"theme_gtsummary_journal(journal = \"jama\") #> Setting theme \"JAMA\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"jama-compact-theme","dir":"Articles","previous_headings":"Setting Themes","what":"JAMA + Compact Theme","title":"gtsummary themes","text":"Themes can stacked well. example , JAMA theme compact theme (reduces font size cell padding) called themes utilized.","code":"theme_gtsummary_journal(journal = \"jama\") #> Setting theme \"JAMA\" theme_gtsummary_compact() #> Setting theme \"Compact\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"jama-compact-language-theme","dir":"Articles","previous_headings":"Setting Themes","what":"JAMA + Compact + Language Theme","title":"gtsummary themes","text":"{gtsummary} tables can translated another language using theme_gtsummary_language()! Clear previously set themes using reset_gtsummary_theme().","code":"reset_gtsummary_theme()"},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"theme-structure","dir":"Articles","previous_headings":"Writing Themes","what":"Theme Structure","title":"gtsummary themes","text":"many parts {gtsummary} table may controlled theme elements. construct personalized theme, create named list least one theme element. ’s example theme modifies function styles p-values updates default statistics reported tbl_summary(). create theme, first check structure using check_gtsummary_theme(). apply set theme set_gtsummary_theme().","code":"my_theme <- list( # round large p-values to two places \"pkgwide-fn:pvalue_fun\" = label_style_pvalue(digits = 2), \"pkgwide-fn:prependpvalue_fun\" = label_style_pvalue(digits = 2, prepend_p = TRUE), # report median (Q1 - Q2) and n (percent) as default stats in `tbl_summary()` \"tbl_summary-arg:statistic\" = list(all_continuous() ~ \"{median} ({p25} - {p75})\", all_categorical() ~ \"{n} ({p})\") ) set_gtsummary_theme(my_theme)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"theme-elements","dir":"Articles","previous_headings":"Writing Themes","what":"Theme Elements","title":"gtsummary themes","text":"theme element follows naming structure: \"-:\". function name function change applies , input type specifies class type theme element, description brief text characterizing theme element. Theme elements fall two categories. first modifying internal behavior functions directly controllable function arguments. second type theme elements set function argument defaults. values theme elements must align functions’ accepted input argument.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Daniel D. Sjoberg. Author, maintainer. Joseph Larmarange. Author. Michael Curry. Author. Jessica Lavery. Author. Karissa Whiting. Author. Emily C. Zabor. Author. Xing Bai. Contributor. Esther Drill. Contributor. Jessica Flynn. Contributor. Margie Hannum. Contributor. Stephanie Lobaugh. Contributor. Shannon Pileggi. Contributor. Amy Tin. Contributor. Gustavo Zapata Wainberg. Contributor.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sjoberg DD, Whiting K, Curry M, Lavery JA, Larmarange J. Reproducible summary tables gtsummary package. R Journal 2021;13:570–80. https://doi.org/10.32614/RJ-2021-053.","code":"@Article{gtsummary, author = {Daniel D. Sjoberg and Karissa Whiting and Michael Curry and Jessica A. Lavery and Joseph Larmarange}, title = {Reproducible Summary Tables with the gtsummary Package}, journal = {{The R Journal}}, year = {2021}, url = {https://doi.org/10.32614/RJ-2021-053}, doi = {10.32614/RJ-2021-053}, volume = {13}, issue = {1}, pages = {570-580}, }"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"gtsummary-","dir":"","previous_headings":"","what":"gtsummary","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"{gtsummary} package provides elegant flexible way create publication-ready analytical summary tables using R programming language. {gtsummary} package summarizes data sets, regression models, , using sensible defaults highly customizable capabilities. Summarize data frames tibbles easily R. Perfect presenting descriptive statistics, comparing group demographics (e.g creating Table 1 medical journals), . Automatically detects continuous, categorical, dichotomous variables data set, calculates appropriate descriptive statistics, also includes amount missingness variable. Summarize regression models R include reference rows categorical variables. Common regression models, logistic regression Cox proportional hazards regression, automatically identified tables pre-filled appropriate column headers (.e. Odds Ratio Hazard Ratio). Customize gtsummary tables using growing list formatting/styling functions. Bold labels, italicize levels, add p-value summary tables, style statistics however choose, merge stack tables present results side side… many possibilities create table dreams! Report statistics inline summary tables regression summary tables R markdown. Make reports completely reproducible! leveraging {broom}, {gt}, {labelled} packages, {gtsummary} creates beautifully formatted, ready--share summary result tables single line R code! Check examples , review vignettes detailed exploration output options, view gallery various customization examples.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"{gtsummary} package written companion {gt} package RStudio. can install {gtsummary} following code. Install development version pak::pkg_install(\"ddsjoberg/gtsummary\", dependencies = TRUE)","code":"install.packages(\"gtsummary\")"},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"summary-table","dir":"","previous_headings":"Examples","what":"Summary Table","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"Use tbl_summary() summarize data frame. Example basic table: many customization options add information (like comparing groups) format results (like bold labels) table. See tbl_summary() tutorial many options, one example.","code":"library(gtsummary) # summarize the data with our package table1 <- trial |> tbl_summary(include = c(age, grade, response)) table2 <- tbl_summary( trial, include = c(age, grade, response), by = trt, # split table by group missing = \"no\" # don't list missing data separately ) |> add_n() |> # add column with total number of non-missing observations add_p() |> # test for a difference between groups modify_header(label = \"**Variable**\") |> # update the column header bold_labels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"regression-models","dir":"","previous_headings":"Examples","what":"Regression Models","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"Use tbl_regression() easily beautifully display regression model results table. See tutorial customization options.","code":"mod1 <- glm(response ~ trt + age + grade, trial, family = binomial) t1 <- tbl_regression(mod1, exponentiate = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"side-by-side-regression-models","dir":"","previous_headings":"Examples","what":"Side-by-side Regression Models","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"can also present side--side regression model results using tbl_merge() Review even output options table gallery.","code":"library(survival) # build survival model table t2 <- coxph(Surv(ttdeath, death) ~ trt + grade + age, trial) |> tbl_regression(exponentiate = TRUE) # merge tables tbl_merge_ex1 <- tbl_merge( tbls = list(t1, t2), tab_spanner = c(\"**Tumor Response**\", \"**Time to Death**\") )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"gtsummary--r-markdown","dir":"","previous_headings":"","what":"gtsummary + R Markdown","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"{gtsummary} package written companion {gt} package RStudio. output types supported {gt} package. Therefore, made possible print {gtsummary} tables various engines. Review gtsummary + R Markdown vignette details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"save-individual-tables","dir":"","previous_headings":"","what":"Save Individual Tables","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"{gtsummary} tables can also saved directly file image, HTML, Word, RTF, LaTeX file.","code":"tbl |> as_gt() |> gt::gtsave(filename = \".\") # use extensions .png, .html, .docx, .rtf, .tex, .ltx"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"additional-resources","dir":"","previous_headings":"","what":"Additional Resources","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"best resources gtsummary vignettes: table gallery, tbl_summary() tutorial, tbl_regression() tutorial, inline_text() tutorial, gtsummary themes, gtsummary+R markdown. R Journal Article Reproducible Summary Tables gtsummary Package. RStudio Education Blog includes post brief introduction package. recording presentation given Weill Cornell Biostatistics Department Memorial Sloan Kettering R Users Group.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"cite-gtsummary","dir":"","previous_headings":"","what":"Cite gtsummary","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"","code":"> citation(\"gtsummary\") To cite gtsummary in publications use: Sjoberg DD, Whiting K, Curry M, Lavery JA, Larmarange J. Reproducible summary tables with the gtsummary package. The R Journal 2021;13:570–80. https://doi.org/10.32614/RJ-2021-053. A BibTeX entry for LaTeX users is @Article{gtsummary, author = {Daniel D. Sjoberg and Karissa Whiting and Michael Curry and Jessica A. Lavery and Joseph Larmarange}, title = {Reproducible Summary Tables with the gtsummary Package}, journal = {{The R Journal}}, year = {2021}, url = {https://doi.org/10.32614/RJ-2021-053}, doi = {10.32614/RJ-2021-053}, volume = {13}, issue = {1}, pages = {570-580}, }"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"Big thank @jeffreybears hex sticker! Please note {gtsummary} project released Contributor Code Conduct. contributing project, agree abide terms. Thank contributors!","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":null,"dir":"Reference","previous_headings":"","what":"Add CI Column — add_ci","title":"Add CI Column — add_ci","text":"Add new column confidence intervals proportions, means, etc.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add CI Column — add_ci","text":"","code":"add_ci(x, ...) # S3 method for class 'tbl_summary' add_ci( x, method = list(all_continuous() ~ \"t.test\", all_categorical() ~ \"wilson\"), include = everything(), statistic = list(all_continuous() ~ \"{conf.low}, {conf.high}\", all_categorical() ~ \"{conf.low}%, {conf.high}%\"), conf.level = 0.95, style_fun = list(all_continuous() ~ label_style_sigfig(), all_categorical() ~ label_style_sigfig(scale = 100)), pattern = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add CI Column — add_ci","text":"x (tbl_summary) summary table class 'tblsummary' ... dots future extensions must empty. method (formula-list-selector) Confidence interval method. Default list(all_continuous() ~ \"t.test\", all_categorical() ~ \"wilson\"). See details . include (tidy-select) Variables include summary table. Default everything(). statistic (formula-list-selector) Indicates confidence interval displayed. Default list(all_continuous() ~ \"{conf.low}, {conf.high}\", all_categorical() ~ \"{conf.low}%, {conf.high}%\") conf.level (scalar real) Confidence level. Default 0.95 style_fun (function) Function style upper lower bound confidence interval. Default list(all_continuous() ~ label_style_sigfig(), all_categorical() ~ label_style_sigfig(scale = 100)). pattern (string) Indicates pattern use merge CI statistics cell. default NULL, columns merged. two columns merged statistics column, represented \"{stat}\" CI column represented \"{ci}\", e.g. pattern = \"{stat} ({ci})\" merge two columns CI parentheses. Default NULL, merging performed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add CI Column — add_ci","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"method-argument","dir":"Reference","previous_headings":"","what":"method argument","title":"Add CI Column — add_ci","text":"Must one \"wilson\", \"wilson..correct\" calculated via prop.test(correct = c(TRUE, FALSE)) categorical variables \"exact\" calculated via stats::binom.test() categorical variables \"wald\", \"wald..correct\" calculated via cardx::proportion_ci_wald(correct = c(TRUE, FALSE) categorical variables \"agresti.coull\" calculated via cardx::proportion_ci_agresti_coull() categorical variables \"jeffreys\" calculated via cardx::proportion_ci_jeffreys() categorical variables \"t.test\" calculated via stats::t.test() continuous variables \"wilcox.test\" calculated via stats::wilcox.test() continuous variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add CI Column — add_ci","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary( missing = \"no\", statistic = all_continuous() ~ \"{mean} ({sd})\", include = c(marker, response, trt) ) |> add_ci() Characteristic N = 2001 95% CI Marker Level (ng/mL) 0.92 (0.86) 0.79, 1.0Tumor Response 61 (32%) 25%, 39%Chemotherapy Treatment     Drug A 98 (49%) 42%, 56%    Drug B 102 (51%) 44%, 58%Abbreviation: CI = Confidence Interval 1 Mean (SD); n (%) # Example 2 ---------------------------------- trial |> select(response, grade) %>% tbl_summary( statistic = all_categorical() ~ \"{p}%\", missing = \"no\", include = c(response, grade) ) |> add_ci(pattern = \"{stat} ({ci})\") |> remove_footnote_header(everything()) Characteristic N = 200 (95% CI) Tumor Response 32% (25%, 39%)Grade     I 34% (28%, 41%)    II 34% (28%, 41%)    III 32% (26%, 39%)Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add CI Column — add_ci.tbl_svysummary","title":"Add CI Column — add_ci.tbl_svysummary","text":"Add new column confidence intervals proportions, means, etc.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add CI Column — add_ci.tbl_svysummary","text":"","code":"# S3 method for class 'tbl_svysummary' add_ci( x, method = list(all_continuous() ~ \"svymean\", all_categorical() ~ \"svyprop.logit\"), include = everything(), statistic = list(all_continuous() ~ \"{conf.low}, {conf.high}\", all_categorical() ~ \"{conf.low}%, {conf.high}%\"), conf.level = 0.95, style_fun = list(all_continuous() ~ label_style_sigfig(), all_categorical() ~ label_style_sigfig(scale = 100)), pattern = NULL, df = survey::degf(x$inputs$data), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add CI Column — add_ci.tbl_svysummary","text":"x (tbl_summary) summary table class 'tblsummary' method (formula-list-selector) Confidence interval method. Default list(all_continuous() ~ \"svymean\", all_categorical() ~ \"svyprop.logit\"). See details . include (tidy-select) Variables include summary table. Default everything(). statistic (formula-list-selector) Indicates confidence interval displayed. Default list(all_continuous() ~ \"{conf.low}, {conf.high}\", all_categorical() ~ \"{conf.low}%, {conf.high}%\") conf.level (scalar real) Confidence level. Default 0.95 style_fun (function) Function style upper lower bound confidence interval. Default list(all_continuous() ~ label_style_sigfig(), all_categorical() ~ label_style_sigfig(scale = 100)). pattern (string) Indicates pattern use merge CI statistics cell. default NULL, columns merged. two columns merged statistics column, represented \"{stat}\" CI column represented \"{ci}\", e.g. pattern = \"{stat} ({ci})\" merge two columns CI parentheses. Default NULL, merging performed. df (numeric) denominator degrees freedom, passed survey::svyciprop(df) confint(df). Default survey::degf(x$inputs$data). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add CI Column — add_ci.tbl_svysummary","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"method-argument","dir":"Reference","previous_headings":"","what":"method argument","title":"Add CI Column — add_ci.tbl_svysummary","text":"Must one \"svyprop.logit\", \"svyprop.likelihood\", \"svyprop.asin\", \"svyprop.beta\", \"svyprop.mean\", \"svyprop.xlogit\" calculated via survey::svyciprop() categorical variables \"svymean\" calculated via survey::svymean() continuous variables \"svymedian.mean\", \"svymedian.beta\", \"svymedian.xlogit\", \"svymedian.asin\", \"svymedian.score\" calculated via survey::svyquantile(quantiles = 0.5) continuous variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add CI Column — add_ci.tbl_svysummary","text":"","code":"data(api, package = \"survey\") survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) |> tbl_svysummary( by = \"both\", include = c(api00, stype), statistic = all_continuous() ~ \"{mean} ({sd})\" ) |> add_stat_label() |> add_ci(pattern = \"{stat} (95% CI {ci})\") |> modify_header(all_stat_cols() ~ \"**{level}**\") |> modify_spanning_header(all_stat_cols() ~ \"**Survived**\") Characteristic Survived No Yes api00, Mean (SD) 633 (96) (95% CI 570, 696) 648 (109) (95% CI 600, 697)stype, n (%)     E 1,083 (64%) (95% CI 43%, 81%) 3,791 (84%) (95% CI 73%, 91%)    H 237 (14%) (95% CI 6.6%, 27%) 237 (5.3%) (95% CI 2.1%, 13%)    M 372 (22%) (95% CI 8.7%, 46%) 474 (11%) (95% CI 5.7%, 19%)Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.html","id":null,"dir":"Reference","previous_headings":"","what":"Add differences — add_difference","title":"Add differences — add_difference","text":"add_difference.tbl_summary() add_difference.tbl_svysummary()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add differences — add_difference","text":"","code":"add_difference(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add differences — add_difference","text":"x (gtsummary) Object class 'gtsummary' ... Passed methods.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add differences — add_difference","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add differences between groups — add_difference.tbl_summary","title":"Add differences between groups — add_difference.tbl_summary","text":"Adds difference tables created tbl_summary(). difference two groups (typically mean rate difference) added table along difference's confidence interval p-value (applicable).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add differences between groups — add_difference.tbl_summary","text":"","code":"# S3 method for class 'tbl_summary' add_difference( x, test = NULL, group = NULL, adj.vars = NULL, test.args = NULL, conf.level = 0.95, include = everything(), pvalue_fun = label_style_pvalue(digits = 1), estimate_fun = list(c(all_continuous(), all_categorical(FALSE)) ~ label_style_sigfig(), all_dichotomous() ~ label_style_sigfig(scale = 100, suffix = \"%\"), all_tests(\"smd\") ~ label_style_sigfig()), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add differences between groups — add_difference.tbl_summary","text":"x (tbl_summary) table created tbl_summary() test (formula-list-selector) Specifies tests/methods perform variable, e.g. list(all_continuous() ~ \"t.test\", all_dichotomous() ~ \"prop.test\", all_categorical(FALSE) ~ \"smd\"). See details default tests ?tests details available tests creating custom tests. group (tidy-select) Variable name ID grouping variable. column can used calculate p-values correlated data. Default NULL. See tests methods utilize group argument. adj.vars (tidy-select) Variables include adjusted calculations (e.g. ANCOVA models). Default NULL. test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). conf.level (numeric) scalar interval (0, 1) indicating confidence level. Default 0.95 include (tidy-select) Variables include output. Default everything(). pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). estimate_fun (formula-list-selector) List formulas specifying functions round format differences confidence limits. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add differences between groups — add_difference.tbl_summary","text":"gtsummary table class \"tbl_summary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add differences between groups — add_difference.tbl_summary","text":"","code":"# Example 1 ---------------------------------- trial |> select(trt, age, marker, response, death) %>% tbl_summary( by = trt, statistic = list( all_continuous() ~ \"{mean} ({sd})\", all_dichotomous() ~ \"{p}%\" ), missing = \"no\" ) |> add_n() |> add_difference() Characteristic N Drug A N = 981 Drug B N = 1021 Difference2 95% CI2 p-value2 Age 189 47 (15) 47 (14) -0.44 -4.6, 3.7 0.8Marker Level (ng/mL) 190 1.02 (0.89) 0.82 (0.83) 0.20 -0.05, 0.44 0.12Tumor Response 193 29% 34% -4.2% -18%, 9.9% 0.6Patient Died 200 53% 59% -5.8% -21%, 9.0% 0.5Abbreviation: CI = Confidence Interval 1 Mean (SD); % 2 Welch Two Sample t-test; 2-sample test for equality of proportions with continuity correction # Example 2 ---------------------------------- # ANCOVA adjusted for grade and stage trial |> select(trt, age, marker, grade, stage) %>% tbl_summary( by = trt, statistic = list(all_continuous() ~ \"{mean} ({sd})\"), missing = \"no\", include = c(age, marker, trt) ) |> add_n() |> add_difference(adj.vars = c(grade, stage)) Characteristic N Drug A N = 981 Drug B N = 1021 Adjusted Difference2 95% CI2 p-value2 Age 189 47 (15) 47 (14) -0.36 -4.5, 3.8 0.9Marker Level (ng/mL) 190 1.02 (0.89) 0.82 (0.83) 0.19 -0.05, 0.43 0.12Abbreviation: CI = Confidence Interval 1 Mean (SD) 2 ANCOVA"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_svysummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add differences between groups — add_difference.tbl_svysummary","title":"Add differences between groups — add_difference.tbl_svysummary","text":"Adds difference tables created tbl_summary(). difference two groups (typically mean rate difference) added table along difference's confidence interval p-value (applicable).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_svysummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add differences between groups — add_difference.tbl_svysummary","text":"","code":"# S3 method for class 'tbl_svysummary' add_difference( x, test = NULL, group = NULL, adj.vars = NULL, test.args = NULL, conf.level = 0.95, include = everything(), pvalue_fun = label_style_pvalue(digits = 1), estimate_fun = list(c(all_continuous(), all_categorical(FALSE)) ~ label_style_sigfig(), all_dichotomous() ~ label_style_sigfig(scale = 100, suffix = \"%\"), all_tests(\"smd\") ~ label_style_sigfig()), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_svysummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add differences between groups — add_difference.tbl_svysummary","text":"x (tbl_summary) table created tbl_summary() test (formula-list-selector) Specifies tests/methods perform variable, e.g. list(all_continuous() ~ \"t.test\", all_dichotomous() ~ \"prop.test\", all_categorical(FALSE) ~ \"smd\"). See details default tests ?tests details available tests creating custom tests. group (tidy-select) Variable name ID grouping variable. column can used calculate p-values correlated data. Default NULL. See tests methods utilize group argument. adj.vars (tidy-select) Variables include adjusted calculations (e.g. ANCOVA models). Default NULL. test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). conf.level (numeric) scalar interval (0, 1) indicating confidence level. Default 0.95 include (tidy-select) Variables include output. Default everything(). pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). estimate_fun (formula-list-selector) List formulas specifying functions round format differences confidence limits. Default list(c(all_continuous(), all_categorical(FALSE)) ~ label_style_sigfig(), all_categorical() ~ \\(x) paste0(style_sigfig(x, scale = 100), \"%\")) ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_svysummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add differences between groups — add_difference.tbl_svysummary","text":"gtsummary table class \"tbl_summary\"","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":null,"dir":"Reference","previous_headings":"","what":"Add model statistics — add_glance","title":"Add model statistics — add_glance","text":"Add model statistics returned broom::glance(). Statistics can either appended table (add_glance_table()), added table source note (add_glance_source_note()).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add model statistics — add_glance","text":"","code":"add_glance_table( x, include = everything(), label = NULL, fmt_fun = list(everything() ~ label_style_sigfig(digits = 3), any_of(\"p.value\") ~ label_style_pvalue(digits = 1), c(where(is.integer), starts_with(\"df\")) ~ label_style_number()), glance_fun = glance_fun_s3(x$inputs$x) ) add_glance_source_note( x, include = everything(), label = NULL, fmt_fun = list(everything() ~ label_style_sigfig(digits = 3), any_of(\"p.value\") ~ label_style_pvalue(digits = 1), c(where(is.integer), starts_with(\"df\")) ~ label_style_number()), glance_fun = glance_fun_s3(x$inputs$x), text_interpret = c(\"md\", \"html\"), sep1 = \" = \", sep2 = \"; \" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add model statistics — add_glance","text":"x (tbl_regression) 'tbl_regression' object include (tidy-select) names statistics include output. Must column names tibble returned broom::glance() glance_fun argument. include argument can also used specify order statistics appear table. label (formula-list-selector) specifies statistic labels, e.g. list(r.squared = \"R2\", p.value = \"P\") fmt_fun (formula-list-selector) Specifies functions used format/round glance statistics. default round number observations degrees freedom nearest integer, p-values styled style_pvalue() remaining statistics styled style_sigfig(x, digits = 3) glance_fun (function) function returns model statistics. Default glance_fun() (broom::glance() model objects). Custom functions must return single row tibble. text_interpret (string) String indicates whether source note text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". sep1 (string) Separator statistic name statistic. Default \" = \", e.g. \"R2 = 0.456\" sep2 (string) Separator statistics. Default \"; \"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add model statistics — add_glance","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"tips","dir":"Reference","previous_headings":"","what":"Tips","title":"Add model statistics — add_glance","text":"combining add_glance_table() tbl_merge(), ordering model terms glance statistics may become jumbled. re-order rows glance statistics bottom, use script :","code":"tbl_merge(list(tbl1, tbl2)) %>% modify_table_body(~.x %>% arrange(row_type == \"glance_statistic\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add model statistics — add_glance","text":"","code":"mod <- lm(age ~ marker + grade, trial) |> tbl_regression() # Example 1 ---------------------------------- mod |> add_glance_table( label = list(sigma = \"\\U03C3\"), include = c(r.squared, AIC, sigma) ) Characteristic Beta 95% CI p-value Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9Grade     I — —     II 0.64 -4.7, 6.0 0.8    III 2.4 -2.8, 7.6 0.4R² 0.005 AIC 1,473 σ 14.6 Abbreviation: CI = Confidence Interval # Example 2 ---------------------------------- mod |> add_glance_source_note( label = list(sigma = \"\\U03C3\"), include = c(r.squared, AIC, sigma) ) Characteristic Beta 95% CI p-value Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9Grade     I — —     II 0.64 -4.7, 6.0 0.8    III 2.4 -2.8, 7.6 0.4Abbreviation: CI = Confidence Interval R² = 0.005; AIC = 1,473; σ = 14.6"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":null,"dir":"Reference","previous_headings":"","what":"Add the global p-values — add_global_p","title":"Add the global p-values — add_global_p","text":"function uses car::Anova() (default) calculate global p-values model covariates. Output tbl_regression tbl_uvregression objects supported.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add the global p-values — add_global_p","text":"","code":"add_global_p(x, ...) # S3 method for class 'tbl_regression' add_global_p( x, include = everything(), keep = FALSE, anova_fun = global_pvalue_fun, type = \"III\", quiet, ... ) # S3 method for class 'tbl_uvregression' add_global_p( x, include = everything(), keep = FALSE, anova_fun = global_pvalue_fun, type = \"III\", quiet, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add the global p-values — add_global_p","text":"x (tbl_regression, tbl_uvregression) Object class 'tbl_regression' 'tbl_uvregression' ... Additional arguments passed car::Anova, aod::wald.test() anova_fun (specified) include (tidy-select) Variables calculate global p-value . Default everything() keep (scalar logical) Logical argument indicating whether also retain individual p-values table output level categorical variable. Default FALSE. anova_fun (function) Function used calculate global p-values. Default generic global_pvalue_fun(), wraps car::Anova() models. type argument passed function. See help file details. pass custom function, must accept first argument model. Note anything passed ... passed function. function must return object class 'cards' (see cardx::ard_car_anova() example), tibble columns 'term' 'p.value' (e.g. \\(x, type, ...) car::Anova(x, type, ...) |> broom::tidy()). type Type argument passed anova_fun. Default \"III\" quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add the global p-values — add_global_p","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add the global p-values — add_global_p","text":"","code":"# Example 1 ---------------------------------- lm(marker ~ age + grade, trial) |> tbl_regression() |> add_global_p() Characteristic Beta 95% CI p-value Age 0.00 -0.01, 0.01 >0.9Grade 0.047    I — —     II -0.38 -0.69, -0.07     III -0.12 -0.43, 0.19 Abbreviation: CI = Confidence Interval # Example 2 ---------------------------------- trial[c(\"response\", \"age\", \"trt\", \"grade\")] |> tbl_uvregression( method = glm, y = response, method.args = list(family = binomial), exponentiate = TRUE ) |> add_global_p() Characteristic N OR 95% CI p-value Age 183 1.02 1.00, 1.04 0.091Chemotherapy Treatment 193 0.5    Drug A — —     Drug B 1.21 0.66, 2.24 Grade 193 >0.9    I — —     II 0.95 0.45, 2.00     III 1.10 0.52, 2.29 Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Add column with N — add_n","title":"Add column with N — add_n","text":"add_n.tbl_summary() add_n.tbl_svysummary() add_n.tbl_regression() add_n.tbl_uvregression() add_n.tbl_survfit()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add column with N — add_n","text":"","code":"add_n(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add column with N — add_n","text":"x (gtsummary) Object class 'gtsummary' ... Passed methods.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add column with N — add_n","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Add N — add_n.tbl_survfit","title":"Add N — add_n.tbl_survfit","text":"survfit() object summarized tbl_survfit() function add total number observations new column.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add N — add_n.tbl_survfit","text":"","code":"# S3 method for class 'tbl_survfit' add_n(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add N — add_n.tbl_survfit","text":"x object class \"tbl_survfit\" ... used","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add N — add_n.tbl_survfit","text":"","code":"library(survival) fit1 <- survfit(Surv(ttdeath, death) ~ 1, trial) fit2 <- survfit(Surv(ttdeath, death) ~ trt, trial) # Example 1 ---------------------------------- list(fit1, fit2) |> tbl_survfit(times = c(12, 24)) |> add_n() Characteristic N Time 12 Time 24 Overall 200 89% (84%, 93%) 44% (38%, 51%)Chemotherapy Treatment 200     Drug A 91% (85%, 97%) 47% (38%, 58%)    Drug B 86% (80%, 93%) 41% (33%, 52%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_regression.html","id":null,"dir":"Reference","previous_headings":"","what":"Add N to regression table — add_n_regression","title":"Add N to regression table — add_n_regression","text":"Add N regression table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_regression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add N to regression table — add_n_regression","text":"","code":"# S3 method for class 'tbl_regression' add_n(x, location = \"label\", ...) # S3 method for class 'tbl_uvregression' add_n(x, location = \"label\", ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_regression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add N to regression table — add_n_regression","text":"x (tbl_regression, tbl_uvregression) tbl_regression tbl_uvregression table location (character) location place Ns. Select one c('label', 'level'). Default 'label'. \"label\" total Ns placed variable's label row. \"level\" level counts placed variable level categorical variables, total N variable's label row continuous. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_regression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add N to regression table — add_n_regression","text":"","code":"# Example 1 ---------------------------------- trial |> select(response, age, grade) |> tbl_uvregression( y = response, exponentiate = TRUE, method = glm, method.args = list(family = binomial), hide_n = TRUE ) |> add_n(location = \"label\") Characteristic N OR 95% CI p-value Age 183 1.02 1.00, 1.04 0.10Grade 193     I — —     II 0.95 0.45, 2.00 0.9    III 1.10 0.52, 2.29 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio # Example 2 ---------------------------------- glm(response ~ age + grade, trial, family = binomial) |> tbl_regression(exponentiate = TRUE) |> add_n(location = \"level\") Characteristic N OR 95% CI p-value Age 183 1.02 1.00, 1.04 0.10Grade     I 65 — —     II 58 0.85 0.39, 1.85 0.7    III 60 1.01 0.47, 2.16 >0.9Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add column with N — add_n_summary","title":"Add column with N — add_n_summary","text":"variable tbl_summary table, add_n function adds column total number non-missing (missing) observations","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add column with N — add_n_summary","text":"","code":"# S3 method for class 'tbl_summary' add_n( x, statistic = \"{N_nonmiss}\", col_label = \"**N**\", footnote = FALSE, last = FALSE, ... ) # S3 method for class 'tbl_svysummary' add_n( x, statistic = \"{N_nonmiss}\", col_label = \"**N**\", footnote = FALSE, last = FALSE, ... ) # S3 method for class 'tbl_likert' add_n( x, statistic = \"{N_nonmiss}\", col_label = \"**N**\", footnote = FALSE, last = FALSE, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add column with N — add_n_summary","text":"x (tbl_summary) Object class 'tbl_summary' created tbl_summary() function. statistic (string) String indicating statistic report. Default number non-missing observation variable, statistic = \"{N_nonmiss}\". statistics available report include: \"{N_obs}\" total number observations, \"{N_nonmiss}\" number non-missing observations, \"{N_miss}\" number missing observations, \"{p_nonmiss}\" percent non-missing data, \"{p_miss}\" percent missing data argument uses glue::glue() syntax multiple statistics may reported, e.g. statistic = \"{N_nonmiss} / {N_obs} ({p_nonmiss}%)\" col_label (string) String indicating column label. Default \"**N**\" footnote (scalar logical) Logical argument indicating whether print footnote clarifying statistics presented. Default FALSE last (scalar logical) Logical indicator include N column last table. Default FALSE, display N column first. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add column with N — add_n_summary","text":"table class c('tbl_summary', 'gtsummary')","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add column with N — add_n_summary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add column with N — add_n_summary","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(trt, age, grade, response)) |> add_n() Characteristic N Drug A N = 981 Drug B N = 1021 Age 189 46 (37, 60) 48 (39, 56)    Unknown 7 4Grade 200     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)Tumor Response 193 28 (29%) 33 (34%)    Unknown 3 41 Median (Q1, Q3); n (%) # Example 2 ---------------------------------- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) |> tbl_svysummary(by = Survived, percent = \"row\", include = c(Class, Age)) |> add_n() Characteristic N No N = 1,4901 Yes N = 7111 Class 2,201     1st 122 (38%) 203 (62%)    2nd 167 (59%) 118 (41%)    3rd 528 (75%) 178 (25%)    Crew 673 (76%) 212 (24%)Age 2,201     Child 52 (48%) 57 (52%)    Adult 1,438 (69%) 654 (31%)1 n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent.tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Add event N — add_nevent.tbl_survfit","title":"Add event N — add_nevent.tbl_survfit","text":"survfit() object summarized tbl_survfit() function add total number events observed new column.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent.tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add event N — add_nevent.tbl_survfit","text":"","code":"# S3 method for class 'tbl_survfit' add_nevent(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent.tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add event N — add_nevent.tbl_survfit","text":"x object class 'tbl_survfit' ... used","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent.tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add event N — add_nevent.tbl_survfit","text":"","code":"library(survival) fit1 <- survfit(Surv(ttdeath, death) ~ 1, trial) fit2 <- survfit(Surv(ttdeath, death) ~ trt, trial) # Example 1 ---------------------------------- list(fit1, fit2) |> tbl_survfit(times = c(12, 24)) |> add_n() |> add_nevent() Characteristic N Event N Time 12 Time 24 Overall 200 112 89% (84%, 93%) 44% (38%, 51%)Chemotherapy Treatment 200 112     Drug A 91% (85%, 97%) 47% (38%, 58%)    Drug B 86% (80%, 93%) 41% (33%, 52%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent_regression.html","id":null,"dir":"Reference","previous_headings":"","what":"Add event N — add_nevent_regression","title":"Add event N — add_nevent_regression","text":"Add event N","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent_regression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add event N — add_nevent_regression","text":"","code":"add_nevent(x, ...) # S3 method for class 'tbl_regression' add_nevent(x, location = \"label\", ...) # S3 method for class 'tbl_uvregression' add_nevent(x, location = \"label\", ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent_regression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add event N — add_nevent_regression","text":"x (tbl_regression, tbl_uvregression) tbl_regression tbl_uvregression table ... dots future extensions must empty. location (character) location place Ns. Select one c('label', 'level'). Default 'label'. \"label\" total Ns placed variable's label row. \"level\" level counts placed variable level categorical variables, total N variable's label row continuous.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent_regression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add event N — add_nevent_regression","text":"","code":"# Example 1 ---------------------------------- trial |> select(response, trt, grade) |> tbl_uvregression( y = response, exponentiate = TRUE, method = glm, method.args = list(family = binomial), ) |> add_nevent() Characteristic N Event N OR 95% CI p-value Chemotherapy Treatment 193 61     Drug A — —     Drug B 1.21 0.66, 2.24 0.5Grade 193 61     I — —     II 0.95 0.45, 2.00 0.9    III 1.10 0.52, 2.29 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio # Example 2 ---------------------------------- glm(response ~ age + grade, trial, family = binomial) |> tbl_regression(exponentiate = TRUE) |> add_nevent(location = \"level\") Characteristic Event N OR 95% CI p-value Age 58 1.02 1.00, 1.04 0.10Grade     I 21 — —     II 17 0.85 0.39, 1.85 0.7    III 20 1.01 0.47, 2.16 >0.9Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":null,"dir":"Reference","previous_headings":"","what":"Add overall column — add_overall","title":"Add overall column — add_overall","text":"Adds column overall summary statistics tables created tbl_summary(), tbl_svysummary(), tbl_continuous() tbl_custom_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add overall column — add_overall","text":"","code":"add_overall(x, ...) # S3 method for class 'tbl_summary' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_continuous' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_svysummary' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_custom_summary' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_hierarchical' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_hierarchical_count' add_overall( x, last = FALSE, col_label = ifelse(rlang::is_empty(x$inputs$denominator), \"**Overall**\", \"**Overall** \\nN = {style_number(N)}\"), statistic = NULL, digits = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add overall column — add_overall","text":"x (tbl_summary, tbl_svysummary, tbl_continuous, tbl_custom_summary) stratified 'gtsummary' table ... dots future extensions must empty. last (scalar logical) Logical indicator display overall column last table. Default FALSE, display overall column first. col_label (string) String indicating column label. Default \"**Overall** \\nN = {style_number(N)}\" statistic (formula-list-selector) Override statistic argument initial tbl_* function call. Default NULL. digits (formula-list-selector) Override digits argument initial tbl_* function call. Default NULL.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add overall column — add_overall","text":"gtsummary class x","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add overall column — add_overall","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add overall column — add_overall","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(include = c(age, grade), by = trt) |> add_overall() Characteristic Overall N = 2001 Drug A N = 981 Drug B N = 1021 Age 47 (38, 57) 46 (37, 60) 48 (39, 56)    Unknown 11 7 4Grade     I 68 (34%) 35 (36%) 33 (32%)    II 68 (34%) 32 (33%) 36 (35%)    III 64 (32%) 31 (32%) 33 (32%)1 Median (Q1, Q3); n (%) # Example 2 ---------------------------------- trial |> tbl_summary( include = grade, by = trt, percent = \"row\", statistic = ~\"{p}%\", digits = ~1 ) |> add_overall( last = TRUE, statistic = ~\"{p}% (n={n})\", digits = ~ c(1, 0) ) Characteristic Drug A N = 981 Drug B N = 1021 Overall N = 2002 Grade     I 51.5% 48.5% 100.0% (n=68)    II 47.1% 52.9% 100.0% (n=68)    III 48.4% 51.6% 100.0% (n=64)1 % 2 % (n=n) # Example 3 ---------------------------------- trial |> tbl_continuous( variable = age, by = trt, include = grade ) |> add_overall(last = TRUE) Characteristic Drug A N = 981 Drug B N = 1021 Overall N = 2001 Grade     I 46 (36, 60) 48 (42, 55) 47 (37, 56)    II 45 (31, 55) 51 (42, 58) 49 (37, 57)    III 52 (42, 61) 45 (36, 52) 47 (38, 58)1 Age: Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":null,"dir":"Reference","previous_headings":"","what":"ARD add overall column — add_overall_ard","title":"ARD add overall column — add_overall_ard","text":"Adds column overall summary statistics tables created tbl_ard_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ARD add overall column — add_overall_ard","text":"","code":"# S3 method for class 'tbl_ard_summary' add_overall( x, cards, last = FALSE, col_label = \"**Overall**\", statistic = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ARD add overall column — add_overall_ard","text":"x (tbl_ard_summary) stratified 'gtsummary' table cards (card) ARD object class \"card\" typically created cards::ard_*() functions. last (scalar logical) Logical indicator display overall column last table. Default FALSE, display overall column first. col_label (string) String indicating column label. Default \"**Overall**\" statistic (formula-list-selector) Override statistic argument initial tbl_* function call. Default NULL. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ARD add overall column — add_overall_ard","text":"gtsummary class x","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"ARD add overall column — add_overall_ard","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ARD add overall column — add_overall_ard","text":"","code":"# Example 1 ---------------------------------- # build primary table tbl <- cards::ard_stack( trial, .by = trt, cards::ard_continuous(variables = age), cards::ard_categorical(variables = grade), .missing = TRUE, .attributes = TRUE, .total_n = TRUE ) |> tbl_ard_summary(by = trt) # create ARD with overall results ard_overall <- cards::ard_stack( trial, cards::ard_continuous(variables = age), cards::ard_categorical(variables = grade), .missing = TRUE, .attributes = TRUE, .total_n = TRUE ) # add an overall column tbl |> add_overall(cards = ard_overall) Characteristic Overall1 Drug A1 Drug B1 Age 47.0 (38.0, 57.0) 46.0 (37.0, 60.0) 48.0 (39.0, 56.0)Grade     I 68 (34.0%) 35 (35.7%) 33 (32.4%)    II 68 (34.0%) 32 (32.7%) 36 (35.3%)    III 64 (32.0%) 31 (31.6%) 33 (32.4%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-values — add_p","title":"Add p-values — add_p","text":"add_p.tbl_summary() add_p.tbl_svysummary() add_p.tbl_continuous() add_p.tbl_cross() add_p.tbl_survfit()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-values — add_p","text":"","code":"add_p(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-values — add_p","text":"x (gtsummary) Object class 'gtsummary' ... Passed methods.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add p-values — add_p","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-values — add_p.tbl_continuous","title":"Add p-values — add_p.tbl_continuous","text":"Add p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-values — add_p.tbl_continuous","text":"","code":"# S3 method for class 'tbl_continuous' add_p( x, test = NULL, pvalue_fun = label_style_pvalue(digits = 1), include = everything(), test.args = NULL, group = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-values — add_p.tbl_continuous","text":"x (tbl_continuous) table created tbl_continuous() test List formulas specifying statistical tests perform variable. Default two-way ANOVA = NULL, defaults add_p.tbl_continuous() = NULL. See tests details, tests, instruction implementing custom test. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). include (tidy-select) Variables include output. Default everything(). test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). group (tidy-select) Variable name ID grouping variable. column can used calculate p-values correlated data. Default NULL. See tests methods utilize group argument. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add p-values — add_p.tbl_continuous","text":"'tbl_continuous' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-values — add_p.tbl_continuous","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_continuous(variable = age, by = trt, include = grade) |> add_p(pvalue_fun = label_style_pvalue(digits = 2)) Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Grade 0.88    I 46 (36, 60) 48 (42, 55)     II 45 (31, 55) 51 (42, 58)     III 52 (42, 61) 45 (36, 52) 1 Age: Median (Q1, Q3) 2 Two-way ANOVA # Example 2 ---------------------------------- trial |> tbl_continuous(variable = age, include = grade) |> add_p(test = everything() ~ \"kruskal.test\") Characteristic N = 2001 p-value2 Grade 0.8    I 47 (37, 56)     II 49 (37, 57)     III 47 (38, 58) 1 Age: Median (Q1, Q3) 2 Kruskal-Wallis rank sum test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-value — add_p.tbl_cross","title":"Add p-value — add_p.tbl_cross","text":"Calculate add p-value comparing two variables cross table. missing levels included tables, also included p-value calculation.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-value — add_p.tbl_cross","text":"","code":"# S3 method for class 'tbl_cross' add_p( x, test = NULL, pvalue_fun = ifelse(source_note, label_style_pvalue(digits = 1, prepend_p = TRUE), label_style_pvalue(digits = 1)), source_note = FALSE, test.args = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-value — add_p.tbl_cross","text":"x (tbl_cross) Object class tbl_cross created tbl_cross() function test (string) string specifying statistical test perform. Default \"chisq.test\" expected cell counts >=5 \"fisher.test\" expected cell counts <5. pvalue_fun (function) Function round format p-value. Default label_style_pvalue(digits = 1), except source_note = TRUE default label_style_pvalue(digits = 1, prepend_p = TRUE) source_note (scalar logical) Logical value indicating whether show p-value {gt} table source notes rather column. test.args (named list) Named list containing additional arguments pass test (accepts additional arguments). example, add argument chi-squared test test.args = list(correct = TRUE) ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add p-value — add_p.tbl_cross","text":"Karissa Whiting, Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-value — add_p.tbl_cross","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_cross(row = stage, col = trt) |> add_p() Chemotherapy Treatment Total p-value1 Drug A Drug B T Stage 0.9    T1 28 25 53     T2 25 29 54     T3 22 21 43     T4 23 27 50 Total 98 102 200 1 Pearson’s Chi-squared test # Example 2 ---------------------------------- trial |> tbl_cross(row = stage, col = trt) |> add_p(source_note = TRUE) Chemotherapy Treatment Total Drug A Drug B T Stage     T1 28 25 53    T2 25 29 54    T3 22 21 43    T4 23 27 50Total 98 102 200Pearson’s Chi-squared test, p=0.9"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-values — add_p.tbl_summary","title":"Add p-values — add_p.tbl_summary","text":"Adds p-values tables created tbl_summary() comparing values across groups.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-values — add_p.tbl_summary","text":"","code":"# S3 method for class 'tbl_summary' add_p( x, test = NULL, pvalue_fun = label_style_pvalue(digits = 1), group = NULL, include = everything(), test.args = NULL, adj.vars = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-values — add_p.tbl_summary","text":"x (tbl_summary) table created tbl_summary() test (formula-list-selector) Specifies statistical tests perform variable, e.g. list(all_continuous() ~ \"t.test\", all_categorical() ~ \"fisher.test\"). See details default tests ?tests details available tests creating custom tests. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). group (tidy-select) Variable name ID grouping variable. column can used calculate p-values correlated data. Default NULL. See tests methods utilize group argument. include (tidy-select) Variables include output. Default everything(). test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). adj.vars (tidy-select) Variables include adjusted calculations (e.g. ANCOVA models). Default NULL. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add p-values — add_p.tbl_summary","text":"gtsummary table class \"tbl_summary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"test-argument","dir":"Reference","previous_headings":"","what":"test argument","title":"Add p-values — add_p.tbl_summary","text":"See ?tests help file details available tests creating custom tests. ?tests help file also includes pseudo-code test clear precisely calculation performed. default test used add_p() primarily depends factors: whether variable categorical/dichotomous vs continuous number levels tbl_summary() variable whether add_p(group) argument specified whether add_p(adj.vars) argument specified","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"specified-neither-add-p-group-nor-add-p-adj-vars-","dir":"Reference","previous_headings":"","what":"Specified neither add_p(group) nor add_p(adj.vars)","title":"Add p-values — add_p.tbl_summary","text":"\"wilcox.test\" variable two levels variable continuous. \"kruskal.test\" variable two levels variable continuous. \"chisq.test..correct\" categorical variables expected cell counts >=5, \"fisher.test\" categorical variables expected cell count <5.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"specified-add-p-group-and-not-add-p-adj-vars-","dir":"Reference","previous_headings":"","what":"Specified add_p(group) and not add_p(adj.vars)","title":"Add p-values — add_p.tbl_summary","text":"\"lme4\" variable two levels summary types. default grouped data variable two levels. Users must create custom tests scenario.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"specified-add-p-adj-vars-and-not-add-p-group-","dir":"Reference","previous_headings":"","what":"Specified add_p(adj.vars) and not add_p(group)","title":"Add p-values — add_p.tbl_summary","text":"\"ancova\" variable continuous variable two levels.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-values — add_p.tbl_summary","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(age, grade)) |> add_p() Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Age 46 (37, 60) 48 (39, 56) 0.7    Unknown 7 4 Grade 0.9    I 35 (36%) 33 (32%)     II 32 (33%) 36 (35%)     III 31 (32%) 33 (32%) 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test; Pearson’s Chi-squared test # Example 2 ---------------------------------- trial |> select(trt, age, marker) |> tbl_summary(by = trt, missing = \"no\") |> add_p( # perform t-test for all variables test = everything() ~ \"t.test\", # assume equal variance in the t-test test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE) ) Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Age 46 (37, 60) 48 (39, 56) 0.8Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) 0.121 Median (Q1, Q3) 2 Two Sample t-test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-value — add_p.tbl_survfit","title":"Add p-value — add_p.tbl_survfit","text":"Calculate add p-value stratified tbl_survfit() tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-value — add_p.tbl_survfit","text":"","code":"# S3 method for class 'tbl_survfit' add_p( x, test = \"logrank\", test.args = NULL, pvalue_fun = label_style_pvalue(digits = 1), include = everything(), quiet, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-value — add_p.tbl_survfit","text":"x (tbl_survfit) Object class \"tbl_survfit\" test (string) string indicating test use. Must one \"logrank\", \"tarone\", \"survdiff\", \"petopeto_gehanwilcoxon\", \"coxph_lrt\", \"coxph_wald\", \"coxph_score\". See details test.args (named list) named list arguments passed method specified test argument. Default NULL. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). include (tidy-select) Variables include output. Default everything(). quiet ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"test-argument","dir":"Reference","previous_headings":"","what":"test argument","title":"Add p-value — add_p.tbl_survfit","text":"common way specify test= using single string indicating test name. However, need specify different tests within table, input flexible using list notation common throughout gtsummary package. example, following code call log-rank test, second test G-rho family.","code":"... |> add_p(test = list(trt ~ \"logrank\", grade ~ \"survdiff\"), test.args = grade ~ list(rho = 0.5))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Add p-value — add_p.tbl_survfit","text":"calculate p-values, formula re-constructed call original survfit() object. survfit() object created loop, lapply(), purrr::map() setting call may reflect true formula may result error incorrect calculation. ensure correct results, call formula survfit() must represent formula used survival::survdiff(). utilize tbl_survfit.data.frame() S3 method, handled .","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-value — add_p.tbl_survfit","text":"","code":"library(survival) gts_survfit <- list( survfit(Surv(ttdeath, death) ~ grade, trial), survfit(Surv(ttdeath, death) ~ trt, trial) ) |> tbl_survfit(times = c(12, 24)) # Example 1 ---------------------------------- gts_survfit |> add_p() Characteristic Time 12 Time 24 p-value1 Grade 0.072    I 97% (93%, 100%) 51% (41%, 65%)     II 82% (74%, 92%) 47% (37%, 61%)     III 86% (78%, 95%) 33% (23%, 47%) Chemotherapy Treatment 0.2    Drug A 91% (85%, 97%) 47% (38%, 58%)     Drug B 86% (80%, 93%) 41% (33%, 52%) 1 Log-rank test # Example 2 ---------------------------------- # Pass `rho=` argument to `survdiff()` gts_survfit |> add_p(test = \"survdiff\", test.args = list(rho = 0.5)) Characteristic Time 12 Time 24 p-value1 Grade 0.070    I 97% (93%, 100%) 51% (41%, 65%)     II 82% (74%, 92%) 47% (37%, 61%)     III 86% (78%, 95%) 33% (23%, 47%) Chemotherapy Treatment 0.2    Drug A 91% (85%, 97%) 47% (38%, 58%)     Drug B 86% (80%, 93%) 41% (33%, 52%) 1 G-rho test (ρ = 0.5)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-values — add_p.tbl_svysummary","title":"Add p-values — add_p.tbl_svysummary","text":"Adds p-values tables created tbl_svysummary() comparing values across groups.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-values — add_p.tbl_svysummary","text":"","code":"# S3 method for class 'tbl_svysummary' add_p( x, test = list(all_continuous() ~ \"svy.wilcox.test\", all_categorical() ~ \"svy.chisq.test\"), pvalue_fun = label_style_pvalue(digits = 1), include = everything(), test.args = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-values — add_p.tbl_svysummary","text":"x (tbl_svysummary) table created tbl_svysummary() test (formula-list-selector) List formulas specifying statistical tests perform. Default list(all_continuous() ~ \"svy.wilcox.test\", all_categorical() ~ \"svy.chisq.test\"). See details default tests ?tests details available tests creating custom tests. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). include (tidy-select) Variables include output. Default everything(). test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add p-values — add_p.tbl_svysummary","text":"gtsummary table class \"tbl_svysummary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-values — add_p.tbl_svysummary","text":"","code":"# Example 1 ---------------------------------- # A simple weighted dataset survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) |> tbl_svysummary(by = Survived, include = c(Sex, Age)) |> add_p() #> The following warnings were returned during `add_p()`: #> ! For variable `Age` (`Survived`) and \"statistic\" and \"p.value\" statistics: #> Chi-squared approximation may be incorrect #> ! For variable `Sex` (`Survived`) and \"statistic\" and \"p.value\" statistics: #> Chi-squared approximation may be incorrect Characteristic No N = 1,4901 Yes N = 7111 p-value2 Sex 0.048    Male 1,364 (92%) 367 (52%)     Female 126 (8.5%) 344 (48%) Age 0.4    Child 52 (3.5%) 57 (8.0%)     Adult 1,438 (97%) 654 (92%) 1 n (%) 2 Pearson’s X^2: Rao & Scott adjustment # A dataset with a complex design data(api, package = \"survey\") d_clust <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) # Example 2 ---------------------------------- tbl_svysummary(d_clust, by = both, include = c(api00, api99)) |> add_p() Characteristic No N = 1,6921 Yes N = 4,5021 p-value2 api00 631 (559, 710) 655 (551, 723) 0.4api99 632 (550, 701) 613 (499, 687) 0.21 Median (Q1, Q3) 2 Design-based KruskalWallis test # Example 3 ---------------------------------- # change tests to svy t-test and Wald test tbl_svysummary(d_clust, by = both, include = c(api00, api99, stype)) |> add_p( test = list( all_continuous() ~ \"svy.t.test\", all_categorical() ~ \"svy.wald.test\" ) ) Characteristic No N = 1,6921 Yes N = 4,5021 p-value2 api00 631 (559, 710) 655 (551, 723) 0.4api99 632 (550, 701) 613 (499, 687) 0.2stype 0.049    E 1,083 (64%) 3,791 (84%)     H 237 (14%) 237 (5.3%)     M 372 (22%) 474 (11%) 1 Median (Q1, Q3); n (%) 2 Design-based t-test; Design-based Wald test of association"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":null,"dir":"Reference","previous_headings":"","what":"Add multiple comparison adjustment — add_q","title":"Add multiple comparison adjustment — add_q","text":"Adjustments p-values performed stats::p.adjust().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add multiple comparison adjustment — add_q","text":"","code":"add_q(x, method = \"fdr\", pvalue_fun = NULL, quiet = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add multiple comparison adjustment — add_q","text":"x (gtsummary) gtsummary object column named \"p.value\" method (string) String indicating method used p-value adjustment. Methods stats::p.adjust() accepted. Default method='fdr'. Must one 'holm', 'hochberg', 'hommel', 'bonferroni', 'BH', '', 'fdr', 'none' pvalue_fun (function) Function round format q-values. Default function specified round existing 'p.value' column. quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add multiple comparison adjustment — add_q","text":"Daniel D. Sjoberg, Esther Drill","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add multiple comparison adjustment — add_q","text":"","code":"# Example 1 ---------------------------------- add_q_ex1 <- trial |> tbl_summary(by = trt, include = c(trt, age, grade, response)) |> add_p() |> add_q() # Example 2 ---------------------------------- trial |> tbl_uvregression( y = response, include = c(\"trt\", \"age\", \"grade\"), method = glm, method.args = list(family = binomial), exponentiate = TRUE ) |> add_global_p() |> add_q() Characteristic N OR 95% CI p-value q-value1 Chemotherapy Treatment 193 0.5 0.8    Drug A — —     Drug B 1.21 0.66, 2.24 Age 183 1.02 1.00, 1.04 0.091 0.3Grade 193 >0.9 >0.9    I — —     II 0.95 0.45, 2.00     III 1.10 0.52, 2.29 Abbreviations: CI = Confidence Interval, OR = Odds Ratio 1 False discovery rate correction for multiple testing"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":null,"dir":"Reference","previous_headings":"","what":"Add significance stars — add_significance_stars","title":"Add significance stars — add_significance_stars","text":"Add significance stars estimates small p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add significance stars — add_significance_stars","text":"","code":"add_significance_stars( x, pattern = ifelse(inherits(x, c(\"tbl_regression\", \"tbl_uvregression\")), \"{estimate}{stars}\", \"{p.value}{stars}\"), thresholds = c(0.001, 0.01, 0.05), hide_ci = TRUE, hide_p = inherits(x, c(\"tbl_regression\", \"tbl_uvregression\")), hide_se = FALSE )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add significance stars — add_significance_stars","text":"x (gtsummary) 'gtsummary' object 'p.value' column pattern (string) glue-syntax string indicating display formatted column. Default \"{estimate}{stars}\" regression summaries \"{p.value}{stars}\" otherwise. footnote placed first column listed pattern. common patterns \"{estimate}{stars} ({conf.low}, {conf.high})\" \"{estimate} ({conf.low} {conf.high}){stars}\" thresholds (numeric) Thresholds significance stars. Default c(0.001, 0.01, 0.05) hide_ci (scalar logical) logical whether hide confidence interval. Default TRUE hide_p (scalar logical) logical whether hide p-value. Default TRUE regression summaries, FALSE otherwise. hide_se (scalar logical) logical whether hide standard error. Default FALSE","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add significance stars — add_significance_stars","text":"'gtsummary' table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add significance stars — add_significance_stars","text":"","code":"tbl <- lm(time ~ ph.ecog + sex, survival::lung) |> tbl_regression(label = list(ph.ecog = \"ECOG Score\", sex = \"Sex\")) # Example 1 ---------------------------------- tbl |> add_significance_stars(hide_ci = FALSE, hide_p = FALSE) Characteristic Beta1 SE 95% CI p-value ECOG Score -58** 19.1 -96, -21 0.003Sex 52 27.9 -2.5, 107 0.061Abbreviations: CI = Confidence Interval, SE = Standard Error 1 *p<0.05; **p<0.01; ***p<0.001 # Example 2 ---------------------------------- tbl |> add_significance_stars( pattern = \"{estimate} ({conf.low}, {conf.high}){stars}\", hide_ci = TRUE, hide_se = TRUE ) |> modify_header(estimate = \"**Beta (95% CI)**\") |> modify_abbreviation(\"CI = Confidence Interval\") Characteristic Beta (95% CI)1 ECOG Score -58 (-96, -21)**Sex 52 (-2.5, 107)Abbreviation: CI = Confidence Interval 1 *p<0.05; **p<0.01; ***p<0.001 # Example 3 ---------------------------------- # Use ' \\n' to put a line break between beta and SE tbl |> add_significance_stars( hide_se = TRUE, pattern = \"{estimate}{stars} \\n({std.error})\" ) |> modify_header(estimate = \"**Beta \\n(SE)**\") |> modify_abbreviation(\"SE = Standard Error\") |> as_gt() |> gt::fmt_markdown(columns = everything()) |> gt::tab_style( style = \"vertical-align:top\", locations = gt::cells_body(columns = label) ) Characteristic Beta (SE)1 ECOG Score -58.1552930554511** (19.0504299286733)Sex 52.4310811827553 (27.8957178715894)Abbreviations: CI = Confidence Interval, SE = Standard Error 1 *p<0.05; **p<0.01; ***p<0.001 # Example 4 ---------------------------------- lm(marker ~ stage + grade, data = trial) |> tbl_regression() |> add_global_p() |> add_significance_stars( hide_p = FALSE, pattern = \"{p.value}{stars}\" ) Characteristic Beta SE p-value1 T Stage 0.2    T1 — —     T2 0.36 0.168     T3 0.23 0.183     T4 0.13 0.171 Grade 0.047*    I — —     II -0.36 0.150     III -0.08 0.150 Abbreviations: CI = Confidence Interval, SE = Standard Error 1 *p<0.05; **p<0.01; ***p<0.001"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a custom statistic — add_stat","title":"Add a custom statistic — add_stat","text":"function allows user add new column (columns) statistics existing tbl_summary, tbl_svysummary, tbl_continuous object.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a custom statistic — add_stat","text":"","code":"add_stat(x, fns, location = everything() ~ \"label\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a custom statistic — add_stat","text":"x (tbl_summary/tbl_svysummary/tbl_continuous) gtsummary table class 'tbl_summary', 'tbl_svysummary', 'tbl_continuous'. fns (formula-list-selector) Indicates functions create statistic. See details . location (formula-list-selector) Indicates location new statistics placed. values must one c(\"label\", \"level\", \"missing\"). \"label\", single statistic placed variable label row. \"level\" statistics placed variable level rows. length vector statistics returned fns function must match dimension levels. Default place new statistics label row.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a custom statistic — add_stat","text":"'gtsummary' class input","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a custom statistic — add_stat","text":"returns custom functions passed fns= required follow specified format. function execute single variable. function must return tibble vector. vector returned, converted tibble one column number rows equal length vector. location='label', returned statistic custom function must tibble one row. location='level' tibble must number rows levels variable (excluding row unknown values). function may take following arguments: foo(data, variable, , tbl, ...) data= input data frame passed tbl_summary() variable= string indicating variable perform calculation . variable label column table. = string indicating variable tbl_summary=, present tbl= original tbl_summary()/tbl_svysummary() object also available utilize user-defined function need utilize inputs. encouraged user-defined function accept ... arguments passed function, even inputs utilized user's function, e.g. foo(data, variable, , ...) Use modify_header() update column headers Use modify_fmt_fun() update functions format statistics Use modify_footnote_header() add explanatory footnote return tibble column names p.value q.value, default p-value formatting applied, may take advantage subsequent p-value formatting functions, bold_p() add_q().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a custom statistic — add_stat","text":"","code":"# Example 1 ---------------------------------- # fn returns t-test pvalue my_ttest <- function(data, variable, by, ...) { t.test(data[[variable]] ~ as.factor(data[[by]]))$p.value } trial |> tbl_summary( by = trt, include = c(trt, age, marker), missing = \"no\" ) |> add_stat(fns = everything() ~ my_ttest) |> modify_header(add_stat_1 = \"**p-value**\", all_stat_cols() ~ \"**{level}**\") Characteristic Drug A1 Drug B1 p-value Age 46 (37, 60) 48 (39, 56) 0.834Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) 0.1161 Median (Q1, Q3) # Example 2 ---------------------------------- # fn returns t-test test statistic and pvalue my_ttest2 <- function(data, variable, by, ...) { t.test(data[[variable]] ~ as.factor(data[[by]])) |> broom::tidy() %>% dplyr::mutate( stat = glue::glue(\"t={style_sigfig(statistic)}, {style_pvalue(p.value, prepend_p = TRUE)}\") ) %>% dplyr::pull(stat) } trial |> tbl_summary( by = trt, include = c(trt, age, marker), missing = \"no\" ) |> add_stat(fns = everything() ~ my_ttest2) |> modify_header(add_stat_1 = \"**Treatment Comparison**\") Characteristic Drug A N = 981 Drug B N = 1021 Treatment Comparison Age 46 (37, 60) 48 (39, 56) t=-0.21, p=0.8Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) t=1.6, p=0.121 Median (Q1, Q3) # Example 3 ---------------------------------- # return test statistic and p-value is separate columns my_ttest3 <- function(data, variable, by, ...) { t.test(data[[variable]] ~ as.factor(data[[by]])) %>% broom::tidy() %>% select(statistic, p.value) } trial |> tbl_summary( by = trt, include = c(trt, age, marker), missing = \"no\" ) |> add_stat(fns = everything() ~ my_ttest3) |> modify_header(statistic = \"**t-statistic**\", p.value = \"**p-value**\") |> modify_fmt_fun(statistic = label_style_sigfig(), p.value = label_style_pvalue(digits = 2)) Characteristic Drug A N = 981 Drug B N = 1021 t-statistic p-value Age 46 (37, 60) 48 (39, 56) -0.21 0.83Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) 1.6 0.121 Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":null,"dir":"Reference","previous_headings":"","what":"Add statistic labels — add_stat_label","title":"Add statistic labels — add_stat_label","text":"Adds modifies labels describing summary statistics presented variable tbl_summary() table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add statistic labels — add_stat_label","text":"","code":"add_stat_label(x, ...) # S3 method for class 'tbl_summary' add_stat_label(x, location = c(\"row\", \"column\"), label = NULL, ...) # S3 method for class 'tbl_svysummary' add_stat_label(x, location = c(\"row\", \"column\"), label = NULL, ...) # S3 method for class 'tbl_ard_summary' add_stat_label(x, location = c(\"row\", \"column\"), label = NULL, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add statistic labels — add_stat_label","text":"x (tbl_summary) Object class 'tbl_summary' class 'tbl_svysummary' ... dots future extensions must empty. location (string) Location statistic label included. \"row\" (default) add statistic label variable label row, \"column\" adds column statistic label. label (formula-list-selector) indicates updates statistic label, e.g. label = all_categorical() ~ \". (%)\". specified, default statistic labels used.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add statistic labels — add_stat_label","text":"tbl_summary tbl_svysummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"tips","dir":"Reference","previous_headings":"","what":"Tips","title":"Add statistic labels — add_stat_label","text":"using add_stat_label(location='row') subsequent tbl_merge(), important somewhat understanding underlying structure gtsummary table. add_stat_label(location='row') works adding new column called \"stat_label\" x$table_body. \"label\" \"stat_label\" columns merged gtsummary table printed. tbl_merge() function merges \"label\" column (among others), typically first column see gtsummary table. Therefore, want merge table run add_stat_label(location='row') need match \"label\" column values \"stat_column\" merged . example, following two tables merge properly addition new \"stat_label\" column requires default labels categorical variables, \". (%)\". can changed either desired text left blank using NA_character_. blank option useful location=\"row\" case keep output categorical variables identical produced without \"add_stat_label()\" function call.","code":"tbl1 <- trial %>% select(age, grade) |> tbl_summary() |> add_stat_label() tbl2 <- lm(marker ~ age + grade, trial) |> tbl_regression() tbl_merge(list(tbl1, tbl2))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add statistic labels — add_stat_label","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add statistic labels — add_stat_label","text":"","code":"tbl <- trial |> dplyr::select(trt, age, grade, response) |> tbl_summary(by = trt) # Example 1 ---------------------------------- # Add statistic presented to the variable label row tbl |> add_stat_label( # update default statistic label for continuous variables label = all_continuous() ~ \"med. (iqr)\" ) Characteristic Drug A N = 98 Drug B N = 102 Age, med. (iqr) 46 (37, 60) 48 (39, 56)    Unknown 7 4Grade, n (%)     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)Tumor Response, n (%) 28 (29%) 33 (34%)    Unknown 3 4 # Example 2 ---------------------------------- tbl |> add_stat_label( # add a new column with statistic labels location = \"column\" ) Characteristic Statistic Drug A N = 98 Drug B N = 102 Age Median (Q1, Q3) 46 (37, 60) 48 (39, 56)    Unknown n 7 4Grade     I n (%) 35 (36%) 33 (32%)    II n (%) 32 (33%) 36 (35%)    III n (%) 31 (32%) 33 (32%)Tumor Response n (%) 28 (29%) 33 (34%)    Unknown n 3 4 # Example 3 ---------------------------------- trial |> select(age, grade, trt) |> tbl_summary( by = trt, type = all_continuous() ~ \"continuous2\", statistic = all_continuous() ~ c(\"{median} ({p25}, {p75})\", \"{min} - {max}\"), ) |> add_stat_label(label = age ~ c(\"IQR\", \"Range\")) Characteristic Drug A N = 98 Drug B N = 102 Age     IQR 46 (37, 60) 48 (39, 56)    Range 6 - 78 9 - 83    Unknown 7 4Grade, n (%)     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_vif.html","id":null,"dir":"Reference","previous_headings":"","what":"Add Variance Inflation Factor — add_vif","title":"Add Variance Inflation Factor — add_vif","text":"Add variance inflation factor (VIF) generalized VIF (GVIF) regression table. Function uses car::vif() calculate VIF.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_vif.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add Variance Inflation Factor — add_vif","text":"","code":"add_vif(x, statistic = NULL, estimate_fun = label_style_sigfig(digits = 2))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_vif.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add Variance Inflation Factor — add_vif","text":"x 'tbl_regression' object statistic \"VIF\" (variance inflation factors, models categorical terms) one /combination \"GVIF\" (generalized variance inflation factors), \"aGVIF\" 'adjusted GVIF, .e. GVIF^[1/(2*df)] /\"df\" (degrees freedom). See car::vif() details. estimate_fun Default label_style_sigfig(digits = 2).","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_vif.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add Variance Inflation Factor — add_vif","text":"","code":"# Example 1 ---------------------------------- lm(age ~ grade + marker, trial) |> tbl_regression() |> add_vif() Characteristic Beta 95% CI p-value GVIF Adjusted GVIF1 Grade 1.0 1.0    I — —     II 0.64 -4.7, 6.0 0.8     III 2.4 -2.8, 7.6 0.4 Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9 1.0 1.0Abbreviations: CI = Confidence Interval, GVIF = Generalized Variance Inflation Factor 1 GVIF^[1/(2*df)] # Example 2 ---------------------------------- lm(age ~ grade + marker, trial) |> tbl_regression() |> add_vif(c(\"aGVIF\", \"df\")) Characteristic Beta 95% CI p-value Adjusted GVIF1 df Grade 1.0 2    I — —     II 0.64 -4.7, 6.0 0.8     III 2.4 -2.8, 7.6 0.4 Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9 1.0 1Abbreviations: CI = Confidence Interval, GVIF = Generalized Variance Inflation Factor, df = degrees of freedom 1 GVIF^[1/(2*df)]"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a flextable object — as_flex_table","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"Function converts gtsummary object flextable object. user can use function wish add customized formatting available via flextable functions. flextable output particularly useful combined R markdown Word output, since gt package support Word.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"","code":"as_flex_table(x, include = everything(), return_calls = FALSE, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"x (gtsummary) object class `\"gtsummary\" include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). return_calls Logical. Default FALSE. TRUE, calls returned list expressions. ... used","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"'flextable' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"as_flex_table() function supports bold italic markdown syntax column headers spanning headers ('**' '_' ). Text wrapped double stars ('**bold**') made bold, text single underscores ('_italic_') made italic. markdown syntax supported double-star underscore combined. style table, may convert table flextable as_flex_table(), utilize flextable functions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"Characteristic Drug N = 981 Drug B N = 1021 p-value2 Age 46 (37, 60) 48 (39, 56) 0.7 Unknown 7 4 Grade 0.9 35 (36%) 33 (32%) II 32 (33%) 36 (35%) III 31 (32%) 33 (32%) 1Median (Q1, Q3); n (%) 2Wilcoxon rank sum test; Pearson's Chi-squared test","code":"trial |> select(trt, age, grade) |> tbl_summary(by = trt) |> add_p() |> as_flex_table() .cl-0d0d8156{}.cl-0d062be0{font-family:'DejaVu Sans';font-size:11pt;font-weight:bold;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;}.cl-0d062bea{font-family:'DejaVu Sans';font-size:11pt;font-weight:normal;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;}.cl-0d062bf4{font-family:'DejaVu Sans';font-size:6.6pt;font-weight:normal;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;position: relative;bottom:3.3pt;}.cl-0d08a9a6{margin:0;text-align:left;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:2pt;padding-top:2pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-0d08a9b0{margin:0;text-align:center;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:2pt;padding-top:2pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-0d08a9b1{margin:0;text-align:left;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-0d08a9ba{margin:0;text-align:center;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-0d08a9bb{margin:0;text-align:left;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:15pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-0d08a9c4{margin:0;text-align:left;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-0d08c6d4{width:1.489in;background-color:transparent;vertical-align: middle;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 1pt solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c6d5{width:1.133in;background-color:transparent;vertical-align: middle;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 1pt solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c6de{width:0.925in;background-color:transparent;vertical-align: middle;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 1pt solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c6e8{width:1.489in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c6e9{width:1.133in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c6f2{width:0.925in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c6f3{width:1.489in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c6f4{width:1.133in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c6fc{width:0.925in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c6fd{width:1.489in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c706{width:1.133in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c707{width:0.925in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c710{width:1.489in;background-color:transparent;vertical-align: top;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c711{width:1.133in;background-color:transparent;vertical-align: top;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c712{width:0.925in;background-color:transparent;vertical-align: top;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c71a{width:1.489in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(255, 255, 255, 0.00);border-top: 0 solid rgba(255, 255, 255, 0.00);border-left: 0 solid rgba(255, 255, 255, 0.00);border-right: 0 solid rgba(255, 255, 255, 0.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c724{width:1.133in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(255, 255, 255, 0.00);border-top: 0 solid rgba(255, 255, 255, 0.00);border-left: 0 solid rgba(255, 255, 255, 0.00);border-right: 0 solid rgba(255, 255, 255, 0.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-0d08c725{width:0.925in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(255, 255, 255, 0.00);border-top: 0 solid rgba(255, 255, 255, 0.00);border-left: 0 solid rgba(255, 255, 255, 0.00);border-right: 0 solid rgba(255, 255, 255, 0.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}CharacteristicDrug A N = 981Drug B N = 1021p-value2Age46 (37, 60)48 (39, 56)0.7Unknown74Grade0.9I35 (36%)33 (32%)II32 (33%)36 (35%)III31 (32%)33 (32%)1Median (Q1, Q3); n (%)2Wilcoxon rank sum test; Pearson's Chi-squared test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to gt — as_gt","title":"Convert gtsummary object to gt — as_gt","text":"Function converts gtsummary object \"gt_tbl\" object, , table created gt::gt(). Function used background results printed knit. user can use function wish add customized formatting available via gt package.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to gt — as_gt","text":"","code":"as_gt(x, include = everything(), return_calls = FALSE, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to gt — as_gt","text":"x (gtsummary) object class `\"gtsummary\" include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). return_calls Logical. Default FALSE. TRUE, calls returned list expressions. ... Arguments passed gt::gt(...)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to gt — as_gt","text":"gt_tbl object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Convert gtsummary object to gt — as_gt","text":"2024-08-15, line breaks (e.g. '\\n') render properly PDF output. now, line breaks stripped rendering PDF Quarto R markdown.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to gt — as_gt","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to gt — as_gt","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(age, grade, response)) |> as_gt() Characteristic Drug A N = 981 Drug B N = 1021 Age 46 (37, 60) 48 (39, 56)    Unknown 7 4Grade     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)Tumor Response 28 (29%) 33 (34%)    Unknown 3 41 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a huxtable object — as_hux_table","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"Function converts gtsummary object huxtable object. user can use function wish add customized formatting available via huxtable functions. huxtable package supports output PDF via LaTeX, well HTML Word.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"","code":"as_hux_table( x, include = everything(), return_calls = FALSE, strip_md_bold = FALSE ) as_hux_xlsx(x, file, include = everything(), bold_header_rows = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"x (gtsummary) object class `\"gtsummary\" include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). return_calls Logical. Default FALSE. TRUE, calls returned list expressions. strip_md_bold file File path output. bold_header_rows (scalar logical) logical indicating whether bold header rows. Default TRUE","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"{huxtable} object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"excel-output","dir":"Reference","previous_headings":"","what":"Excel Output","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"Use as_hux_xlsx() function save copy table excel file. file saved using huxtable::quick_xlsx().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"David Hugh-Jones, Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"","code":"trial |> tbl_summary(by = trt, include = c(age, grade)) |> add_p() |> as_hux_table() #> Characteristic Drug AN = 98 Drug BN = 102 p-value #> ─────────────────────────────────────────────────────────── #> Age 46 (37, 60) 48 (39, 56) 0.7 #> Unknown 7 4 #> Grade 0.9 #> I 35 (36%) 33 (32%) #> II 32 (33%) 36 (35%) #> III 31 (32%) 33 (32%) #> ─────────────────────────────────────────────────────────── #> Median (Q1, Q3); n (%) #> Wilcoxon rank sum test; Pearson's Chi-squared #> test #> #> Column names: label, stat_1, stat_2, p.value"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a kable object — as_kable","title":"Convert gtsummary object to a kable object — as_kable","text":"Output knitr::kable() less full featured compared summary tables produced gt. example, kable summary tables include indentation, footnotes, spanning header rows. Line breaks (\\n) removed column headers table cells.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a kable object — as_kable","text":"","code":"as_kable(x, ..., include = everything(), return_calls = FALSE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a kable object — as_kable","text":"x (gtsummary) Object created function gtsummary package (e.g. tbl_summary tbl_regression) ... Additional arguments passed knitr::kable() include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). return_calls Logical. Default FALSE. TRUE, calls returned list expressions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a kable object — as_kable","text":"knitr_kable object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert gtsummary object to a kable object — as_kable","text":"Tip: better distinguish variable labels level labels indenting supported, try bold_labels() italicize_levels().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a kable object — as_kable","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a kable object — as_kable","text":"","code":"trial |> tbl_summary(by = trt) |> bold_labels() |> as_kable() #> #> #> |**Characteristic** | **Drug A** N = 98 | **Drug B** N = 102 | #> |:--------------------------|:------------------:|:-------------------:| #> |__Age__ | 46 (37, 60) | 48 (39, 56) | #> |Unknown | 7 | 4 | #> |__Marker Level (ng/mL)__ | 0.84 (0.23, 1.60) | 0.52 (0.18, 1.21) | #> |Unknown | 6 | 4 | #> |__T Stage__ | | | #> |T1 | 28 (29%) | 25 (25%) | #> |T2 | 25 (26%) | 29 (28%) | #> |T3 | 22 (22%) | 21 (21%) | #> |T4 | 23 (23%) | 27 (26%) | #> |__Grade__ | | | #> |I | 35 (36%) | 33 (32%) | #> |II | 32 (33%) | 36 (35%) | #> |III | 31 (32%) | 33 (32%) | #> |__Tumor Response__ | 28 (29%) | 33 (34%) | #> |Unknown | 3 | 4 | #> |__Patient Died__ | 52 (53%) | 60 (59%) | #> |__Months to Death/Censor__ | 23.5 (17.4, 24.0) | 21.2 (14.5, 24.0) |"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a kableExtra object — as_kable_extra","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"Function converts gtsummary object knitr_kable + kableExtra object. allows customized formatting available via knitr::kable() {kableExtra}; as_kable_extra() supports arguments knitr::kable(). as_kable_extra() output via gtsummary supports bold italic cells table bodies. Users encouraged leverage as_kable_extra() enhanced pdf printing; html output options better support via as_gt().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"","code":"as_kable_extra( x, escape = FALSE, format = NULL, ..., include = everything(), addtl_fmt = TRUE, return_calls = FALSE )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"x (gtsummary) Object created function gtsummary package (e.g. tbl_summary tbl_regression) format, escape, ... arguments passed knitr::kable(). Default escape = FALSE, format auto-detected. include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). addtl_fmt logical indicating whether include additional formatting. Default TRUE. primarily used escape special characters, convert markdown LaTeX, remove line breaks footnote. return_calls Logical. Default FALSE. TRUE, calls returned list expressions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"{kableExtra} table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"pdf-latex","dir":"Reference","previous_headings":"","what":"PDF/LaTeX","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"section shows options intended use output: pdf_document yaml .Rmd. default values as_kable_extra(escape = FALSE, addtl_fmt = TRUE) utilized, following formatting occurs. Markdown bold, italic, underline syntax headers, spanning headers, caption, footnote converted escaped LaTeX code Special characters table body, headers, spanning headers, caption, footnote escaped .escape_latex() .escape_latex2() \"\\n\" symbol recognized line break table headers, spanning headers, caption, table body \"\\n\" symbol removed footnotes suppress additional formats, set as_kable_extra(addtl_fmt = FALSE) Additional styling available kableExtra::kable_styling() shown Example 2, implements row striping repeated column headers presence page breaks.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"html","dir":"Reference","previous_headings":"","what":"HTML","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"section discusses options intended use output: html_document yaml .Rmd. default values as_kable_extra(escape = FALSE, addtl_fmt = TRUE) utilized, following formatting occurs. default markdown syntax headers spanning headers removed Special characters table body, headers, spanning headers, caption, footnote escaped .escape_html() \"\\n\" symbol removed footnotes suppress additional formatting, set as_kable_extra(addtl_fmt = FALSE)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"","code":"# basic gtsummary tbl to build upon as_kable_extra_base <- trial |> tbl_summary(by = trt, include = c(age, stage)) |> bold_labels() # Example 1 (PDF via LaTeX) --------------------- # add linebreak in table header with '\\n' as_kable_extra_ex1_pdf <- as_kable_extra_base |> modify_header(all_stat_cols() ~ \"**{level}** \\n*N = {n}*\") |> as_kable_extra() # Example 2 (PDF via LaTeX) --------------------- # additional styling in `knitr::kable()` and with # call to `kableExtra::kable_styling()` as_kable_extra_ex2_pdf <- as_kable_extra_base |> as_kable_extra( booktabs = TRUE, longtable = TRUE, linesep = \"\" ) |> kableExtra::kable_styling( position = \"left\", latex_options = c(\"striped\", \"repeat_header\"), stripe_color = \"gray!15\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a tibble — as_tibble.gtsummary","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"Function converts gtsummary object tibble.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"","code":"# S3 method for class 'gtsummary' as_tibble( x, include = everything(), col_labels = TRUE, return_calls = FALSE, fmt_missing = FALSE, ... ) # S3 method for class 'gtsummary' as.data.frame(...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"x (gtsummary) object class `\"gtsummary\" include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). col_labels (scalar logical) Logical argument adding column labels output tibble. Default TRUE. return_calls Logical. Default FALSE. TRUE, calls returned list expressions. fmt_missing (scalar logical) Logical argument adding missing value formats. ... Arguments passed gt::gt(...)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"tibble","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"","code":"tbl <- trial |> tbl_summary(by = trt, include = c(age, grade, response)) as_tibble(tbl) #> # A tibble: 8 × 3 #> `**Characteristic**` `**Drug A** \\nN = 98` `**Drug B** \\nN = 102` #> #> 1 Age 46 (37, 60) 48 (39, 56) #> 2 Unknown 7 4 #> 3 Grade NA NA #> 4 I 35 (36%) 33 (32%) #> 5 II 32 (33%) 36 (35%) #> 6 III 31 (32%) 33 (32%) #> 7 Tumor Response 28 (29%) 33 (34%) #> 8 Unknown 3 4 # without column labels as_tibble(tbl, col_labels = FALSE) #> # A tibble: 8 × 3 #> label stat_1 stat_2 #> #> 1 Age 46 (37, 60) 48 (39, 56) #> 2 Unknown 7 4 #> 3 Grade NA NA #> 4 I 35 (36%) 33 (32%) #> 5 II 32 (33%) 36 (35%) #> 6 III 31 (32%) 33 (32%) #> 7 Tumor Response 28 (29%) 33 (34%) #> 8 Unknown 3 4"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Default Digits — assign_summary_digits","title":"Assign Default Digits — assign_summary_digits","text":"Used assign default formatting variables summarized tbl_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Default Digits — assign_summary_digits","text":"","code":"assign_summary_digits(data, statistic, type, digits = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Default Digits — assign_summary_digits","text":"data (data.frame) data frame statistic (named list) named list; notably, formula-list-selector type (named list) named list; notably, formula-list-selector digits (named list) named list; notably, formula-list-selector. Default NULL","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Default Digits — assign_summary_digits","text":"named list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Default Digits — assign_summary_digits","text":"","code":"assign_summary_digits( mtcars, statistic = list(mpg = \"{mean}\"), type = list(mpg = \"continuous\") ) #> $mpg #> $mpg$mean #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) #> #> #> #> $mpg$N_obs #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) #> #> #> #> $mpg$N_miss #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) #> #> #> #> $mpg$N_nonmiss #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) #> #> #> #> $mpg$p_miss #> function (x) #> style_percent(x, prefix = prefix, suffix = suffix, digits = digits, #> big.mark = big.mark, decimal.mark = decimal.mark, ...) #> #> #> #> $mpg$p_nonmiss #> function (x) #> style_percent(x, prefix = prefix, suffix = suffix, digits = digits, #> big.mark = big.mark, decimal.mark = decimal.mark, ...) #> #> #> #>"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Default Summary Type — assign_summary_type","title":"Assign Default Summary Type — assign_summary_type","text":"Function inspects data assigns summary type specified type argument.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Default Summary Type — assign_summary_type","text":"","code":"assign_summary_type(data, variables, value, type = NULL, cat_threshold = 10L)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Default Summary Type — assign_summary_type","text":"data (data.frame) data frame variables (character) character vector column names data value (named list) named list values show dichotomous variables, names variables type (named list) named list summary types, names variables cat_threshold (integer) base R numeric classes fewer levels threshold default categorical summary. Default 10L","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Default Summary Type — assign_summary_type","text":"named list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Default Summary Type — assign_summary_type","text":"","code":"assign_summary_type( data = trial, variables = c(\"age\", \"grade\", \"response\"), value = NULL ) #> $age #> [1] \"continuous\" #> #> $grade #> [1] \"categorical\" #> #> $response #> [1] \"dichotomous\" #>"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Test — assign_tests","title":"Assign Test — assign_tests","text":"function used assign default tests add_p() add_difference().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Test — assign_tests","text":"","code":"assign_tests(x, ...) # S3 method for class 'tbl_summary' assign_tests( x, include, by = x$inputs$by, test = NULL, group = NULL, adj.vars = NULL, summary_type = x$inputs$type, calling_fun = c(\"add_p\", \"add_difference\"), ... ) # S3 method for class 'tbl_svysummary' assign_tests( x, include, by = x$inputs$by, test = NULL, group = NULL, adj.vars = NULL, summary_type = x$inputs$type, calling_fun = c(\"add_p\", \"add_difference\"), ... ) # S3 method for class 'tbl_continuous' assign_tests(x, include, by, cont_variable, test = NULL, group = NULL, ...) # S3 method for class 'tbl_survfit' assign_tests(x, include, test = NULL, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Test — assign_tests","text":"x (gtsummary) table class 'gtsummary' ... Passed rlang::abort(), rlang::warn() rlang::inform(). include (character) Character vector column names assign default tests. (string) single stratifying column name test (named list) named list tests. group (string) variable name indicating grouping column correlated data. Default NULL. adj.vars (character) Variables include adjusted calculations (e.g. ANCOVA models). summary_type (named list) named list summary types calling_fun (string) Must one 'add_p' 'add_difference'. Depending context, different defaults set. cont_variable (string) column name continuous summary variable tbl_continuous()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Test — assign_tests","text":"table class 'gtsummary'","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Test — assign_tests","text":"","code":"trial |> tbl_summary( by = trt, include = c(age, stage) ) |> assign_tests(include = c(\"age\", \"stage\"), calling_fun = \"add_p\") #> $age #> function (data, variable, by, test.args, conf.level = 0.95, ...) #> { #> check_pkg_installed(\"cardx\") #> check_empty(c(\"group\", \"adj.vars\"), ...) #> dplyr::mutate(rlang::inject(cardx::ard_stats_wilcox_test(data = data, #> variable = all_of(variable), by = all_of(by), conf.int = TRUE, #> conf.level = conf.level, !!!test.args)), stat = dplyr::case_when(.data$stat_name %in% #> \"method\" & .data$stat %in% \"Wilcoxon rank sum test with continuity correction\" ~ #> list(\"Wilcoxon rank sum test\"), .default = .data$stat)) #> } #> #> #> attr(,\"test_name\") #> [1] \"wilcox.test\" #> #> $stage #> function (data, variable, by, test.args, ...) #> { #> add_p_test_chisq.test(data = data, variable = variable, by = by, #> test.args = c(list(correct = FALSE), test.args), ...) #> } #> #> #> attr(,\"test_name\") #> [1] \"chisq.test.no.correct\" #>"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":null,"dir":"Reference","previous_headings":"","what":"Bold or Italicize — bold_italicize_labels_levels","title":"Bold or Italicize — bold_italicize_labels_levels","text":"Bold italicize labels levels gtsummary tables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bold or Italicize — bold_italicize_labels_levels","text":"","code":"bold_labels(x) italicize_labels(x) bold_levels(x) italicize_levels(x) # S3 method for class 'gtsummary' bold_labels(x) # S3 method for class 'gtsummary' bold_levels(x) # S3 method for class 'gtsummary' italicize_labels(x) # S3 method for class 'gtsummary' italicize_levels(x) # S3 method for class 'tbl_cross' bold_labels(x) # S3 method for class 'tbl_cross' bold_levels(x) # S3 method for class 'tbl_cross' italicize_labels(x) # S3 method for class 'tbl_cross' italicize_levels(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bold or Italicize — bold_italicize_labels_levels","text":"x (gtsummary) object class 'gtsummary'","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bold or Italicize — bold_italicize_labels_levels","text":"Functions return class gtsummary object supplied","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Bold or Italicize — bold_italicize_labels_levels","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bold or Italicize — bold_italicize_labels_levels","text":"","code":"# Example 1 ---------------------------------- tbl_summary(trial, include = c(\"trt\", \"age\", \"response\")) |> bold_labels() |> bold_levels() |> italicize_labels() |> italicize_levels() Characteristic N = 2001 Chemotherapy Treatment     Drug A 98 (49%)    Drug B 102 (51%)Age 47 (38, 57)    Unknown 11Tumor Response 61 (32%)    Unknown 71 n (%); Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":null,"dir":"Reference","previous_headings":"","what":"Bold significant p-values — bold_p","title":"Bold significant p-values — bold_p","text":"Bold values chosen threshold (e.g. <0.05) gtsummary tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bold significant p-values — bold_p","text":"","code":"bold_p(x, t = 0.05, q = FALSE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bold significant p-values — bold_p","text":"x (gtsummary) Object created using gtsummary functions t (scalar numeric) Threshold values bold. Default 0.05. q (scalar logical) TRUE bold q-value column rather p-value. Default FALSE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Bold significant p-values — bold_p","text":"Daniel D. Sjoberg, Esther Drill","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bold significant p-values — bold_p","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(response, marker, trt), missing = \"no\") |> add_p() |> bold_p(t = 0.1) Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Tumor Response 28 (29%) 33 (34%) 0.5Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) 0.0851 n (%); Median (Q1, Q3) 2 Pearson’s Chi-squared test; Wilcoxon rank sum test # Example 2 ---------------------------------- glm(response ~ trt + grade, trial, family = binomial(link = \"logit\")) |> tbl_regression(exponentiate = TRUE) |> bold_p(t = 0.65) Characteristic OR 95% CI p-value Chemotherapy Treatment     Drug A — —     Drug B 1.21 0.66, 2.24 0.5Grade     I — —     II 0.94 0.44, 1.98 0.9    III 1.09 0.52, 2.27 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Continuous Summary Table Bridges — brdg_continuous","title":"Continuous Summary Table Bridges — brdg_continuous","text":"Bridge function converting tbl_continuous() cards basic gtsummary objects. bridge function converts 'cards' object format suitable pass brdg_summary(): pier_*() functions required.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Continuous Summary Table Bridges — brdg_continuous","text":"","code":"brdg_continuous(cards, by = NULL, statistic, include, variable, type)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Continuous Summary Table Bridges — brdg_continuous","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. (string) string indicating stratifying column statistic (named list) named list summary statistic names include (tidy-select) Variables include summary table. Default everything(). variable (tidy-select) single column data. Variable name continuous column summarized. type (named list) named list summary types","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Continuous Summary Table Bridges — brdg_continuous","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Continuous Summary Table Bridges — brdg_continuous","text":"","code":"library(cards) bind_ard( # the primary ARD with the results ard_continuous(trial, by = grade, variables = age), # add missing and attributes ARD ard_missing(trial, by = grade, variables = age), ard_attributes(trial, variables = c(grade, age)) ) |> # adding the column name dplyr::mutate( gts_column = ifelse(!context %in% \"attributes\", \"stat_0\", NA_character_) ) |> brdg_continuous( variable = \"age\", include = \"grade\", statistic = list(grade = \"{median} ({p25}, {p75})\"), type = list(grade = \"categorical\") ) |> as_tibble() #> # A tibble: 4 × 2 #> `**Characteristic**` stat_0 #> #> 1 Grade NA #> 2 I 47.0 (37.0, 56.0) #> 3 II 48.5 (37.0, 57.0) #> 4 III 47.0 (38.0, 58.0)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_hierarchical.html","id":null,"dir":"Reference","previous_headings":"","what":"Hierarchy table bridge — brdg_hierarchical","title":"Hierarchy table bridge — brdg_hierarchical","text":"Bridge function converting tbl_hierarchical() (similar) cards basic gtsummary objects. bridge functions begin prefix brdg_*(). file also contains helper functions constructing bridge, referred piers (supports bridge) begin pier_*(). brdg_hierarchical(): bridge function ingests ARD data frame returns gtsummary table includes .$table_body basic .$table_styling. .$table_styling$header data frame includes header statistics. Based context, function adds column ARD data frame named \"gts_column\". column used reshaping pier_*() functions defining column names. pier_*(): functions accept cards tibble returns tibble piece .$table_body. Typically stacked construct final table body data frame. ARD object passed two primary parts: calculated summary statistics attributes ARD. attributes ARD used labeling. ARD data frame passed function must include \"gts_column\" column, added brdg_hierarchical().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_hierarchical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Hierarchy table bridge — brdg_hierarchical","text":"","code":"brdg_hierarchical( cards, variables, by, include, statistic, overall_row, count, is_ordered, label ) pier_summary_hierarchical(cards, variables, include, statistic)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_hierarchical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Hierarchy table bridge — brdg_hierarchical","text":"cards (card) ARD object class \"card\" created cards::ard_hierarchical_stack(). variables (character) character list hierarchy variables. (string) string indicating stratifying column. include (character) character list hierarchy variables include summary statistics . statistic (named list) named list summary statistic names. overall_row (scalar logical) whether overall summary row included top table. default FALSE. count (scalar logical) whether tbl_hierarchical_count() (TRUE) tbl_hierarchical() (FALSE) applied. is_ordered (scalar logical) whether last variable variables ordered. label (named list) named list hierarchy variable labels.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_hierarchical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Hierarchy table bridge — brdg_hierarchical","text":"gtsummary object","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary table bridge — brdg_summary","title":"Summary table bridge — brdg_summary","text":"Bridge function converting tbl_summary() (similar) cards basic gtsummary objects. bridge functions begin prefix brdg_*(). file also contains helper functions constructing bridge, referred piers (supports bridge) begin pier_*(). brdg_summary(): bridge function ingests ARD data frame returns gtsummary table includes .$table_body basic .$table_styling. .$table_styling$header data frame includes header statistics. Based context, function adds column ARD data frame named \"gts_column\". column used reshaping pier_*() functions defining column names. pier_*(): functions accept cards tibble returns tibble piece .$table_body. Typically stacked construct final table body data frame. ARD object passed two primary parts: calculated summary statistics attributes ARD. attributes ARD used labeling. ARD data frame passed function must include \"gts_column\" column, added brdg_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary table bridge — brdg_summary","text":"","code":"brdg_summary( cards, variables, type, statistic, by = NULL, missing = \"no\", missing_stat = \"{N_miss}\", missing_text = \"Unknown\" ) pier_summary_dichotomous(cards, variables, statistic) pier_summary_categorical(cards, variables, statistic) pier_summary_continuous2(cards, variables, statistic) pier_summary_continuous(cards, variables, statistic) pier_summary_missing_row( cards, variables, missing = \"no\", missing_stat = \"{N_miss}\", missing_text = \"Unknown\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary table bridge — brdg_summary","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. variables (character) character list variables type (named list) named list summary types statistic (named list) named list summary statistic names (string) string indicating stratifying column missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"ifany\", \"\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary table bridge — brdg_summary","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary table bridge — brdg_summary","text":"","code":"library(cards) # first build ARD data frame cards <- ard_stack( mtcars, ard_continuous(variables = c(\"mpg\", \"hp\")), ard_categorical(variables = \"cyl\"), ard_dichotomous(variables = \"am\"), .missing = TRUE, .attributes = TRUE ) |> # this column is used by the `pier_*()` functions dplyr::mutate(gts_column = ifelse(context == \"attributes\", NA, \"stat_0\")) brdg_summary( cards = cards, variables = c(\"cyl\", \"am\", \"mpg\", \"hp\"), type = list( cyl = \"categorical\", am = \"dichotomous\", mpg = \"continuous\", hp = \"continuous2\" ), statistic = list( cyl = \"{n} / {N}\", am = \"{n} / {N}\", mpg = \"{mean} ({sd})\", hp = c(\"{median} ({p25}, {p75})\", \"{mean} ({sd})\") ) ) |> as_tibble() #> # A tibble: 9 × 2 #> `**Characteristic**` stat_0 #> #> 1 cyl NA #> 2 4 11 / 32 #> 3 6 7 / 32 #> 4 8 14 / 32 #> 5 am 13 / 32 #> 6 mpg 20.1 (6.0) #> 7 hp NA #> 8 Median (Q1, Q3) 123.0 (96.0, 180.0) #> 9 Mean (SD) 146.7 (68.6) pier_summary_dichotomous( cards = cards, variables = \"am\", statistic = list(am = \"{n} ({p})\") ) #> # A tibble: 1 × 5 #> row_type var_label variable label stat_0 #> #> 1 label am am am 13 (40.6) pier_summary_categorical( cards = cards, variables = \"cyl\", statistic = list(cyl = \"{n} ({p})\") ) #> # A tibble: 4 × 5 #> variable var_label row_type label stat_0 #> #> 1 cyl cyl label cyl NA #> 2 cyl cyl level 4 11 (34.4) #> 3 cyl cyl level 6 7 (21.9) #> 4 cyl cyl level 8 14 (43.8) pier_summary_continuous2( cards = cards, variables = \"hp\", statistic = list(hp = c(\"{median}\", \"{mean}\")) ) #> # A tibble: 3 × 5 #> variable var_label row_type label stat_0 #> #> 1 hp hp label hp NA #> 2 hp hp level Median 123.0 #> 3 hp hp level Mean 146.7 pier_summary_continuous( cards = cards, variables = \"mpg\", statistic = list(mpg = \"{median}\") ) #> # A tibble: 1 × 5 #> row_type var_label variable label stat_0 #> #> 1 label mpg mpg mpg 19.2"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide summary table bridge — brdg_wide_summary","title":"Wide summary table bridge — brdg_wide_summary","text":"Bridge function converting tbl_wide_summary() (similar) cards basic gtsummary objects. bridge functions begin prefix brdg_*().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide summary table bridge — brdg_wide_summary","text":"","code":"brdg_wide_summary(cards, variables, statistic, type)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wide summary table bridge — brdg_wide_summary","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. variables (character) character list variables statistic (named list) named list summary statistic names type (named list) named list summary types","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wide summary table bridge — brdg_wide_summary","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Wide summary table bridge — brdg_wide_summary","text":"","code":"library(cards) bind_ard( ard_continuous(trial, variables = c(age, marker)), ard_attributes(trial, variables = c(age, marker)) ) |> brdg_wide_summary( variables = c(\"age\", \"marker\"), statistic = list(age = c(\"{mean}\", \"{sd}\"), marker = c(\"{mean}\", \"{sd}\")), type = list(age = \"continuous\", marker = \"continuous\") ) Characteristic Mean SD Age 47.2 14.3Marker Level (ng/mL) 0.9 0.9"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":null,"dir":"Reference","previous_headings":"","what":"Combine terms — combine_terms","title":"Combine terms — combine_terms","text":"function combines terms regression model, replaces terms single row output table. p-value calculated using stats::anova().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Combine terms — combine_terms","text":"","code":"combine_terms(x, formula_update, label = NULL, quiet, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Combine terms — combine_terms","text":"x (tbl_regression) tbl_regression object formula_update (formula) formula update passed stats::update(). updated formula used construct reduced model, subsequently passed stats::anova() calculate p-value group removed terms. See stats::update() function's formula.= argument proper syntax. label (string) Optional string argument labeling combined rows quiet ... Additional arguments passed stats::anova","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Combine terms — combine_terms","text":"tbl_regression object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Combine terms — combine_terms","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Combine terms — combine_terms","text":"","code":"# Example 1 ---------------------------------- # Logistic Regression Example, LRT p-value glm(response ~ marker + I(marker^2) + grade, trial[c(\"response\", \"marker\", \"grade\")] |> na.omit(), # keep complete cases only! family = binomial) |> tbl_regression(label = grade ~ \"Grade\", exponentiate = TRUE) |> # collapse non-linear terms to a single row in output using anova combine_terms( formula_update = . ~ . - marker - I(marker^2), label = \"Marker (non-linear terms)\", test = \"LRT\" ) Characteristic OR 95% CI p-value Marker (non-linear terms) 0.2Grade     I — —     II 1.16 0.52, 2.55 0.7    III 1.07 0.50, 2.30 0.9Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize a continuous variable — continuous_summary","title":"Summarize a continuous variable — continuous_summary","text":"helper, used tbl_custom_summary(), creates function summarizing continuous variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize a continuous variable — continuous_summary","text":"","code":"continuous_summary(variable)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize a continuous variable — continuous_summary","text":"variable (string) String indicating name variable summarized. variable continuous.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Summarize a continuous variable — continuous_summary","text":"using continuous_summary(), can specify statistic= argument tbl_custom_summary() continuous statistics tbl_summary(). See statistic argument section help file tbl_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summarize a continuous variable — continuous_summary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom tidiers — custom_tidiers","title":"Custom tidiers — custom_tidiers","text":"Collection tidiers can utilized gtsummary. See details .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom tidiers — custom_tidiers","text":"","code":"tidy_standardize( x, exponentiate = FALSE, conf.level = 0.95, conf.int = TRUE, ..., quiet = FALSE ) tidy_bootstrap( x, exponentiate = FALSE, conf.level = 0.95, conf.int = TRUE, ..., quiet = FALSE ) tidy_robust( x, exponentiate = FALSE, conf.level = 0.95, conf.int = TRUE, vcov = NULL, vcov_args = NULL, ..., quiet = FALSE ) pool_and_tidy_mice(x, pool.args = NULL, ..., quiet = FALSE) tidy_gam(x, conf.int = FALSE, exponentiate = FALSE, conf.level = 0.95, ...) tidy_wald_test(x, tidy_fun = NULL, vcov = stats::vcov(x), ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom tidiers — custom_tidiers","text":"x (model) Regression model object exponentiate (scalar logical) Logical indicating whether exponentiate coefficient estimates. Default FALSE. conf.level (scalar real) Confidence level confidence interval/credible interval. Defaults 0.95. conf.int (scalar logical) Logical indicating whether include confidence interval output. Default TRUE. ... Arguments passed method; pool_and_tidy_mice(): mice::tidy(x, ...) tidy_standardize(): parameters::standardize_parameters(x, ...) tidy_bootstrap(): parameters::bootstrap_parameters(x, ...) tidy_robust(): parameters::model_parameters(x, ...) quiet vcov, vcov_args tidy_robust(): Arguments passed parameters::model_parameters(). least one arguments must specified. tidy_wald_test(): vcov covariance matrix model default stats::vcov(). pool.args (named list) Named list arguments passed mice::pool() pool_and_tidy_mice(). Default NULL tidy_fun (function) Tidier function model. Default use broom::tidy(). error occurs, tidying model attempted parameters::model_parameters(), installed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"regression-model-tidiers","dir":"Reference","previous_headings":"","what":"Regression Model Tidiers","title":"Custom tidiers — custom_tidiers","text":"tidiers passed tbl_regression() tbl_uvregression() obtain modified results. tidy_standardize() tidier report standardized coefficients. parameters package includes wonderful function estimate standardized coefficients. tidier uses output parameters::standardize_parameters(), merely takes result puts broom::tidy() format. tidy_bootstrap() tidier report bootstrapped coefficients. parameters package includes wonderful function estimate bootstrapped coefficients. tidier uses output parameters::bootstrap_parameters(test = \"p\"), merely takes result puts broom::tidy() format. tidy_robust() tidier report robust standard errors, confidence intervals, p-values. parameters package includes wonderful function calculate robust standard errors, confidence intervals, p-values tidier uses output parameters::model_parameters(), merely takes result puts broom::tidy() format. use function tbl_regression(), pass function arguments tidy_robust() populated. pool_and_tidy_mice() tidier report models resulting multiply imputed data using mice package. Pass mice model object model results pooled. See example.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"other-tidiers","dir":"Reference","previous_headings":"","what":"Other Tidiers","title":"Custom tidiers — custom_tidiers","text":"tidy_wald_test() tidier report Wald p-values, wrapping aod::wald.test() function. Use tidier add_global_p(anova_fun = tidy_wald_test)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom tidiers — custom_tidiers","text":"","code":"# Example 1 ---------------------------------- mod <- lm(age ~ marker + grade, trial) tbl_stnd <- tbl_regression(mod, tidy_fun = tidy_standardize) tbl <- tbl_regression(mod) tidy_standardize_ex1 <- tbl_merge( list(tbl_stnd, tbl), tab_spanner = c(\"**Standardized Model**\", \"**Original Model**\") ) # Example 2 ---------------------------------- # use \"posthoc\" method for coef calculation tbl_regression(mod, tidy_fun = \\(x, ...) tidy_standardize(x, method = \"posthoc\", ...)) Characteristic Beta 95% CI Marker Level (ng/mL) 0.00 -0.15, 0.15Grade     I — —    II 0.04 -0.32, 0.41    III 0.17 -0.20, 0.53Abbreviation: CI = Confidence Interval # Example 3 ---------------------------------- # Multiple Imputation using the mice package set.seed(1123) pool_and_tidy_mice_ex3 <- suppressWarnings(mice::mice(trial, m = 2)) |> with(lm(age ~ marker + grade)) |> tbl_regression() #> #> iter imp variable #> 1 1 age marker response #> 1 2 age marker response #> 2 1 age marker response #> 2 2 age marker response #> 3 1 age marker response #> 3 2 age marker response #> 4 1 age marker response #> 4 2 age marker response #> 5 1 age marker response #> 5 2 age marker response"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/default_stat_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Default Statistics Labels — default_stat_labels","title":"Default Statistics Labels — default_stat_labels","text":"Default Statistics Labels","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/default_stat_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Default Statistics Labels — default_stat_labels","text":"","code":"default_stat_labels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/default_stat_labels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Default Statistics Labels — default_stat_labels","text":"named list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated.html","id":null,"dir":"Reference","previous_headings":"","what":"Deprecated functions — deprecated","title":"Deprecated functions — deprecated","text":"functions deprecated longer actively supported.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Deprecated functions — deprecated","text":"","code":"modify_cols_merge(...)"},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_ci_column.html","id":"overview","dir":"Reference","previous_headings":"","what":"Overview","title":"Column ","text":"gtsummary package first written, gt package CRAN version package available ability merge columns. Due limitations, pre-formatted \"ci\" column added show combined \"conf.low\" \"conf.high\" columns. Column merging gt gtsummary packages matured years, now adopting modern approach using features. result, pre-formatted \"ci\" column eventually dropped .$table_body. using column merging, conf.low conf.high remain numeric can continue update columns formatted, even printing table. \"ci\" column hidden, meaning appears .$table_body, printed. means references column code error, likely intended effect.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_ci_column.html","id":"how-to-update-","dir":"Reference","previous_headings":"","what":"How to update?","title":"Column ","text":"cases simple change adapt code updated structure: simply swap ci conf.low. See examples update code.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_ci_column.html","id":"modify-header-","dir":"Reference","previous_headings":"","what":"modify_header()","title":"Column ","text":"\"ci\" column hidden, new header defined column unhidden. Code changes header \"ci\" likely lead duplicate columns appearing table (, \"ci\" column merged \"conf.low\" \"conf.high\" columns).","code":""},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":null,"dir":"Reference","previous_headings":"","what":"DEPRECATED Footnote — deprecated_modify_footnote","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"Use modify_footnote_header() modify_abbreviation() instead.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"","code":"modify_footnote( x, ..., abbreviation = FALSE, text_interpret = c(\"md\", \"html\"), update, quiet )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"x (gtsummary) gtsummary object ... dynamic-dots Used assign updates footnotes. Use modify_footnote(colname='new footnote') update single footnote. abbreviation (scalar logical) Logical indicating abbreviation updated. text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}. update, quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"","code":"# Use `modify_footnote_header()`, `modify_footnote_body()`, `modify_abbreviation()` instead."},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-create_gtsummary_object.html","id":null,"dir":"Reference","previous_headings":"","what":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","title":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","text":"Function uses table_body create gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-create_gtsummary_object.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","text":"","code":".create_gtsummary_object(table_body, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-create_gtsummary_object.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","text":"table_body table_body tibble ... objects added gtsummary object list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-create_gtsummary_object.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert Named List to Table Body — .list2tb","title":"Convert Named List to Table Body — .list2tb","text":"Many arguments 'gtsummary' accept named lists. function converts named list .$table_body format expected scope_table_body()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert Named List to Table Body — .list2tb","text":"","code":".list2tb(x, colname = caller_arg(x))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert Named List to Table Body — .list2tb","text":"x named list colname string column name assign. Default caller_arg(x)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert Named List to Table Body — .list2tb","text":".$table_body data frame","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert Named List to Table Body — .list2tb","text":"","code":"type <- list(age = \"continuous\", response = \"dichotomous\") gtsummary:::.list2tb(type, \"var_type\") #> # A tibble: 2 × 2 #> variable var_type #> #> 1 age continuous #> 2 response dichotomous"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":null,"dir":"Reference","previous_headings":"","what":"Object Convert Helper — .table_styling_expr_to_row_number","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"Ahead gtsummary object converted output type, logical expression saved x$table_styling converted list row numbers.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"","code":".table_styling_expr_to_row_number(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"x gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"","code":"tbl <- trial %>% tbl_summary(include = c(age, grade)) %>% .table_styling_expr_to_row_number()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract ARDs — gather_ard","title":"Extract ARDs — gather_ard","text":"Extract ARDs gtsummary table. needed, results may combined cards::bind_ard().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract ARDs — gather_ard","text":"","code":"gather_ard(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract ARDs — gather_ard","text":"x (gtsummary) gtsummary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract ARDs — gather_ard","text":"list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract ARDs — gather_ard","text":"","code":"tbl_summary(trial, by = trt, include = age) |> add_overall() |> add_p() |> gather_ard() #> $tbl_summary #> {cards} data frame: 27 x 12 #> group1 group1_level variable variable_level stat_name stat_label stat #> 1 trt Drug A age median Median 46 #> 2 trt Drug A age p25 Q1 37 #> 3 trt Drug A age p75 Q3 60 #> 4 trt Drug B age median Median 48 #> 5 trt Drug B age p25 Q1 39 #> 6 trt Drug B age p75 Q3 56 #> 7 age label Variable… Age #> 8 age class Variable… numeric #> 9 trt label Variable… Chemothe… #> 10 trt class Variable… character #> ℹ 17 more rows #> ℹ Use `print(n = ...)` to see more rows #> ℹ 5 more variables: context, fmt_fn, warning, error, gts_column #> #> $add_overall #> {cards} data frame: 11 x 9 #> variable context stat_name stat_label stat fmt_fn #> 1 age continuo… median Median 47 #> 2 age continuo… p25 Q1 38 #> 3 age continuo… p75 Q3 57 #> 4 age attribut… label Variable… Age #> 5 age attribut… class Variable… numeric NULL #> 6 age missing N_obs No. obs. 200 #> 7 age missing N_miss N Missing 11 #> 8 age missing N_nonmiss N Non-mi… 189 #> 9 age missing p_miss % Missing 0.055 #> 10 age missing p_nonmiss % Non-mi… 0.945 #> 11 ..ard_total_n.. total_n N N 200 0 #> ℹ 3 more variables: warning, error, gts_column #> #> $add_p #> $add_p$age #> {cards} data frame: 15 x 9 #> group1 variable context stat_name stat_label stat #> 1 trt age stats_wi… estimate Median o… -1 #> 2 trt age stats_wi… statistic X-square… 4323 #> 3 trt age stats_wi… p.value p-value 0.718 #> 4 trt age stats_wi… conf.low CI Lower… -5 #> 5 trt age stats_wi… conf.high CI Upper… 4 #> 6 trt age stats_wi… method method Wilcoxon… #> 7 trt age stats_wi… alternative alternat… two.sided #> 8 trt age stats_wi… mu mu 0 #> 9 trt age stats_wi… paired Paired t… FALSE #> 10 trt age stats_wi… exact exact #> 11 trt age stats_wi… correct correct TRUE #> 12 trt age stats_wi… conf.int conf.int TRUE #> 13 trt age stats_wi… conf.level CI Confi… 0.95 #> 14 trt age stats_wi… tol.root tol.root 0 #> 15 trt age stats_wi… digits.rank digits.r… Inf #> ℹ 3 more variables: fmt_fn, warning, error #> #> glm(response ~ trt, data = trial, family = binomial()) |> tbl_regression() |> gather_ard() #> {cards} data frame: 29 x 9 #> variable variable_level context stat_name stat_label stat #> 1 trt Drug A regressi… term term trtDrug A #> 2 trt Drug A regressi… var_label Label Chemothe… #> 3 trt Drug A regressi… var_class Class character #> 4 trt Drug A regressi… var_type Type dichotom… #> 5 trt Drug A regressi… var_nlevels N Levels 2 #> 6 trt Drug A regressi… contrasts contrasts contr.tr… #> 7 trt Drug A regressi… contrasts_type Contrast… treatment #> 8 trt Drug A regressi… reference_row referenc… TRUE #> 9 trt Drug A regressi… label Level La… Drug A #> 10 trt Drug A regressi… n_obs N Obs. 95 #> ℹ 19 more rows #> ℹ Use `print(n = ...)` to see more rows #> ℹ 3 more variables: fmt_fn, warning, error"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":null,"dir":"Reference","previous_headings":"","what":"Default glance function — glance_fun_s3","title":"Default glance function — glance_fun_s3","text":"S3 generic used default function add_glance*(glance_fun). provided various regression model classes can default functions returning statistics.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Default glance function — glance_fun_s3","text":"","code":"glance_fun_s3(x, ...) # Default S3 method glance_fun_s3(x, ...) # S3 method for class 'mira' glance_fun_s3(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Default glance function — glance_fun_s3","text":"x (regression model) regression model object ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Default glance function — glance_fun_s3","text":"function","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Default glance function — glance_fun_s3","text":"","code":"mod <- lm(age ~ trt, trial) glance_fun_s3(mod) #> function (x, ...) #> { #> UseMethod(\"glance\") #> } #> #> "},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/global_pvalue_fun.html","id":null,"dir":"Reference","previous_headings":"","what":"Global p-value generic — global_pvalue_fun","title":"Global p-value generic — global_pvalue_fun","text":"S3 generic serves default add_global_p(anova_fun). default function uses car::Anova() (via cardx::ard_car_anova()) calculate p-values. method GEE models (created geepack::geeglm()) returns Wald tests calculated using aod::wald.test() (via cardx::ard_aod_wald_test()). method, type argument used.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/global_pvalue_fun.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Global p-value generic — global_pvalue_fun","text":"","code":"global_pvalue_fun(x, type, ...) # Default S3 method global_pvalue_fun(x, type, ...) # S3 method for class 'geeglm' global_pvalue_fun(x, type, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/global_pvalue_fun.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Global p-value generic — global_pvalue_fun","text":"data frame","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/global_pvalue_fun.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Global p-value generic — global_pvalue_fun","text":"","code":"lm(age ~ stage + grade, trial) |> global_pvalue_fun(type = \"III\") #> {cards} data frame: 15 x 8 #> variable context stat_name stat_label stat fmt_fn #> 1 (Intercept) car_anova sumsq sumsq 65248.66 1 #> 2 (Intercept) car_anova df Degrees … 1 1 #> 3 (Intercept) car_anova meansq meansq 65248.66 1 #> 4 (Intercept) car_anova statistic Statistic 315.641 1 #> 5 (Intercept) car_anova p.value p-value 0 1 #> 6 stage car_anova sumsq sumsq 548.715 1 #> 7 stage car_anova df Degrees … 3 1 #> 8 stage car_anova meansq meansq 182.905 1 #> 9 stage car_anova statistic Statistic 0.885 1 #> 10 stage car_anova p.value p-value 0.45 1 #> 11 grade car_anova sumsq sumsq 166.309 1 #> 12 grade car_anova df Degrees … 2 1 #> 13 grade car_anova meansq meansq 83.154 1 #> 14 grade car_anova statistic Statistic 0.402 1 #> 15 grade car_anova p.value p-value 0.669 1 #> ℹ 2 more variables: warning, error"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gtsummary-package.html","id":null,"dir":"Reference","previous_headings":"","what":"gtsummary: Presentation-Ready Data Summary and Analytic Result Tables — gtsummary-package","title":"gtsummary: Presentation-Ready Data Summary and Analytic Result Tables — gtsummary-package","text":"Creates presentation-ready tables summarizing data sets, regression models, . code create tables concise highly customizable. Data frames can summarized function, e.g. mean(), median(), even user-written functions. Regression models summarized include reference rows categorical variables. Common regression models, logistic regression Cox proportional hazards regression, automatically identified tables pre-filled appropriate column headers.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gtsummary-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"gtsummary: Presentation-Ready Data Summary and Analytic Result Tables — gtsummary-package","text":"Maintainer: Daniel D. Sjoberg danield.sjoberg@gmail.com (ORCID) Authors: Joseph Larmarange (ORCID) Michael Curry (ORCID) Jessica Lavery (ORCID) Karissa Whiting (ORCID) Emily C. Zabor (ORCID) contributors: Xing Bai [contributor] Esther Drill (ORCID) [contributor] Jessica Flynn (ORCID) [contributor] Margie Hannum (ORCID) [contributor] Stephanie Lobaugh [contributor] Shannon Pileggi (ORCID) [contributor] Amy Tin (ORCID) [contributor] Gustavo Zapata Wainberg (ORCID) [contributor]","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from summary tables inline — inline_text.gtsummary","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"Report statistics summary tables inline","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"","code":"# S3 method for class 'gtsummary' inline_text(x, variable, level = NULL, column = NULL, pattern = NULL, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"x (gtsummary) gtsummary object variable (tidy-select) single variable name statistic present level (string) Level variable display categorical variables. Default NULL column (tidy-select) Column name return x$table_body. pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default NULL ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"string","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":"column-pattern","dir":"Reference","previous_headings":"","what":"column + pattern","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"gtsummary tables report multiple statistics single cell, e.g. \"{mean} ({sd})\" tbl_summary() tbl_svysummary(). often need report just mean SD, can accomplished using column= pattern= arguments. arguments specified, column argument selects column report statistics , pattern argument specifies statistics report, e.g. inline_text(x, column = \"stat_1\", pattern = \"{mean}\") reports just mean tbl_summary(). supported tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from gtsummary tables inline — inline_text","title":"Report statistics from gtsummary tables inline — inline_text","text":"Report statistics gtsummary tables inline","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from gtsummary tables inline — inline_text","text":"","code":"inline_text(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from gtsummary tables inline — inline_text","text":"x (gtsummary) Object created gtsummary function ... Additional arguments passed methods.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from gtsummary tables inline — inline_text","text":"string reporting results gtsummary table","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from gtsummary tables inline — inline_text","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from summary tables inline — inline_text.tbl_continuous","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"Extracts returns statistics tbl_continuous() object inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"","code":"# S3 method for class 'tbl_continuous' inline_text( x, variable, column = NULL, level = NULL, pattern = NULL, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"x (tbl_continuous) Object created tbl_continuous() variable (tidy-select) single variable name statistic present column (tidy-select) Column name return x$table_body. Can also pass level variable. level (string) Level variable display categorical variables. Default NULL pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default NULL pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"","code":"t1 <- trial |> tbl_summary(by = trt, include = grade) |> add_p() inline_text(t1, variable = grade, level = \"I\", column = \"Drug A\", pattern = \"{n}/{N} ({p}%)\") #> 35/98 (36%) inline_text(t1, variable = grade, column = \"p.value\") #> [1] \"p=0.9\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from cross table inline — inline_text.tbl_cross","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"Extracts returns statistics tbl_cross object inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"","code":"# S3 method for class 'tbl_cross' inline_text( x, col_level, row_level = NULL, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"x (tbl_cross) tbl_cross object col_level (string) Level column variable display. Can also specify \"p.value\" p-value \"stat_0\" Total column. row_level (string) Level row variable display. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"","code":"tbl_cross <- tbl_cross(trial, row = trt, col = response) %>% add_p() inline_text(tbl_cross, row_level = \"Drug A\", col_level = \"1\") #> [1] \"28\" inline_text(tbl_cross, row_level = \"Total\", col_level = \"1\") #> [1] \"61\" inline_text(tbl_cross, col_level = \"p.value\") #> [1] \"p=0.7\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from regression summary tables inline — inline_text.tbl_regression","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"Takes object class tbl_regression, location statistic report returns statistics reporting inline R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"","code":"# S3 method for class 'tbl_regression' inline_text( x, variable, level = NULL, pattern = \"{estimate} ({conf.level*100}% CI {conf.low}, {conf.high}; {p.value})\", estimate_fun = x$inputs$estimate_fun, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"x (tbl_regression) Object created tbl_regression() variable (tidy-select) single variable name statistic present level (string) Level variable display categorical variables. Default NULL pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default \"{estimate} ({conf.level }\\% CI {conf.low}, {conf.high}; {p.value})\". columns x$table_body available print well confidence level (conf.level). See details. estimate_fun (function) Function style model coefficient estimates. Columns 'estimate', 'conf.low', 'conf.high' formatted. Default x$inputs$estimate_fun pvalue_fun function style p-values /q-values. Default label_style_pvalue(prepend_p = TRUE) ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"pattern-argument","dir":"Reference","previous_headings":"","what":"pattern argument","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"following items () available print. Use print(x$table_body) print table estimates extracted . {estimate} coefficient estimate formatted 'estimate_fun' {conf.low} lower limit confidence interval formatted 'estimate_fun' {conf.high} upper limit confidence interval formatted 'estimate_fun' {p.value} p-value formatted 'pvalue_fun' {N} number observations model {label} variable/variable level label","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"","code":"inline_text_ex1 <- glm(response ~ age + grade, trial, family = binomial(link = \"logit\")) %>% tbl_regression(exponentiate = TRUE) inline_text(inline_text_ex1, variable = age) #> [1] \"1.02 (95% CI 1.00, 1.04; p=0.10)\" inline_text(inline_text_ex1, variable = grade, level = \"III\") #> [1] \"1.01 (95% CI 0.47, 2.16; p>0.9)\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from summary tables inline — inline_text.tbl_summary","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"Extracts returns statistics tbl_summary() object inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"","code":"# S3 method for class 'tbl_summary' inline_text( x, variable, column = NULL, level = NULL, pattern = NULL, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... ) # S3 method for class 'tbl_svysummary' inline_text( x, variable, column = NULL, level = NULL, pattern = NULL, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"x (tbl_summary) Object created tbl_summary() tbl_svysummary() variable (tidy-select) single variable name statistic present column (tidy-select) Column name return x$table_body. Can also pass level variable. level (string) Level variable display categorical variables. Default NULL pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default NULL pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"","code":"t1 <- trial |> tbl_summary(by = trt, include = grade) |> add_p() inline_text(t1, variable = grade, level = \"I\", column = \"Drug A\", pattern = \"{n}/{N} ({p}%)\") #> 35/98 (36%) inline_text(t1, variable = grade, column = \"p.value\") #> [1] \"p=0.9\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from survfit tables inline — inline_text.tbl_survfit","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"Extracts returns statistics tbl_survfit object inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"","code":"# S3 method for class 'tbl_survfit' inline_text( x, variable = NULL, level = NULL, pattern = NULL, time = NULL, prob = NULL, column = NULL, estimate_fun = x$inputs$estimate_fun, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"x (tbl_survfit) Object created tbl_survfit() variable (tidy-select) Variable name statistic present. level (string) Level variable display categorical variables. Can also specify 'Unknown' row. Default NULL pattern (string) String indicating statistics return. time, prob (numeric scalar) time probability return result column (tidy-select) column print x$table_body. Columns may selected time prob arguments well. estimate_fun (function) Function round format estimate confidence limits. Default function used tbl_survfit() pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"","code":"library(survival) # fit survfit fit1 <- survfit(Surv(ttdeath, death) ~ trt, trial) fit2 <- survfit(Surv(ttdeath, death) ~ 1, trial) # sumarize survfit objects tbl1 <- tbl_survfit( fit1, times = c(12, 24), label = ~\"Treatment\", label_header = \"**{time} Month**\" ) %>% add_p() tbl2 <- tbl_survfit( fit2, probs = 0.5, label_header = \"**Median Survival**\" ) # report results inline inline_text(tbl1, time = 24, level = \"Drug B\") #> [1] \"41% (33%, 52%)\" inline_text(tbl1, time = 24, level = \"Drug B\", pattern = \"{estimate} [95% CI {conf.low}, {conf.high}]\") #> 41% [95% CI 33%, 52%] inline_text(tbl1, column = p.value) #> [1] \"p=0.2\" inline_text(tbl2, prob = 0.5) #> [1] \"22 (21, —)\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"Extracts returns statistics table created tbl_uvregression function inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"","code":"# S3 method for class 'tbl_uvregression' inline_text( x, variable, level = NULL, pattern = \"{estimate} ({conf.level*100}% CI {conf.low}, {conf.high}; {p.value})\", estimate_fun = x$inputs$estimate_fun, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"x (tbl_uvregression) Object created tbl_uvregression() variable (tidy-select) single variable name statistic present level (string) Level variable display categorical variables. Default NULL pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default NULL estimate_fun (function) Function style model coefficient estimates. Columns 'estimate', 'conf.low', 'conf.high' formatted. Default x$inputs$estimate_fun pvalue_fun function style p-values /q-values. Default label_style_pvalue(prepend_p = TRUE) ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"pattern-argument","dir":"Reference","previous_headings":"","what":"pattern argument","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"following items () available print. Use print(x$table_body) print table estimates extracted . {estimate} coefficient estimate formatted 'estimate_fun' {conf.low} lower limit confidence interval formatted 'estimate_fun' {conf.high} upper limit confidence interval formatted 'estimate_fun' {p.value} p-value formatted 'pvalue_fun' {N} number observations model {label} variable/variable level label","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"","code":"inline_text_ex1 <- trial[c(\"response\", \"age\", \"grade\")] %>% tbl_uvregression( method = glm, method.args = list(family = binomial), y = response, exponentiate = TRUE ) inline_text(inline_text_ex1, variable = age) #> [1] \"1.02 (95% CI 1.00, 1.04; p=0.10)\" inline_text(inline_text_ex1, variable = grade, level = \"III\") #> [1] \"1.10 (95% CI 0.52, 2.29; p=0.8)\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":null,"dir":"Reference","previous_headings":"","what":"Is a date/time — is_date_time","title":"Is a date/time — is_date_time","text":"is_date_time(): Predicate date, time, date-time vector identification.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Is a date/time — is_date_time","text":"","code":"is_date_time(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Is a date/time — is_date_time","text":"x vector","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Is a date/time — is_date_time","text":"scalar logical","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Is a date/time — is_date_time","text":"","code":"iris |> dplyr::mutate(date = as.Date(\"2000-01-01\") + dplyr::row_number()) |> lapply(gtsummary:::is_date_time) #> $Sepal.Length #> [1] FALSE #> #> $Sepal.Width #> [1] FALSE #> #> $Petal.Length #> [1] FALSE #> #> $Petal.Width #> [1] FALSE #> #> $Species #> [1] FALSE #> #> $date #> [1] TRUE #>"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":null,"dir":"Reference","previous_headings":"","what":"Special Character Escape — kableExtra_utils","title":"Special Character Escape — kableExtra_utils","text":"utility functions copied internals kableExtra, assist escaping special characters LaTeX HTML tables. function assist creations tables via as_kable_extra().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Special Character Escape — kableExtra_utils","text":"","code":".escape_html(x) .escape_latex(x, newlines = TRUE, align = \"c\") .escape_latex2(x, newlines = TRUE, align = \"c\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Special Character Escape — kableExtra_utils","text":"x character vector","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Special Character Escape — kableExtra_utils","text":"character vector escaped special characters","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Special Character Escape — kableExtra_utils","text":"","code":".escape_latex(c(\"%\", \"{test}\")) #> [1] \"\\\\%\" \"\\\\{test\\\\}\" .escape_html(c(\">0.9\", \"line\\nbreak\")) #> [1] \">0.9\" \"line
break\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Style Functions — label_style","title":"Style Functions — label_style","text":"Similar style_*() family functions, functions return style_*() function rather performing styling.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style Functions — label_style","text":"","code":"label_style_number( digits = 0, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), scale = 1, prefix = \"\", suffix = \"\", ... ) label_style_sigfig( digits = 2, scale = 1, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", ... ) label_style_pvalue( digits = 1, prepend_p = FALSE, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), ... ) label_style_ratio( digits = 2, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", ... ) label_style_percent( prefix = \"\", suffix = \"\", digits = 0, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style Functions — label_style","text":"digits, big.mark, decimal.mark, scale, prepend_p, prefix, suffix, ... arguments passed style_*() functions","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style Functions — label_style","text":"function","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style Functions — label_style","text":"","code":"my_style <- label_style_number(digits = 1) my_style(3.14) #> [1] \"3.1\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify column headers, footnotes, and spanning headers — modify","title":"Modify column headers, footnotes, and spanning headers — modify","text":"functions assist modifying aesthetics/style table. modify_header() update column headers modify_spanning_header() update/add spanning headers functions often require users know underlying column names. Run show_header_names() print column names console.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify column headers, footnotes, and spanning headers — modify","text":"","code":"modify_header(x, ..., text_interpret = c(\"md\", \"html\"), quiet, update) modify_spanning_header(x, ..., text_interpret = c(\"md\", \"html\"), quiet, update) show_header_names(x, include_example, quiet)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify column headers, footnotes, and spanning headers — modify","text":"x (gtsummary) gtsummary object ... dynamic-dots Used assign updates headers spanning headers. Use modify_*(colname='new header') update single column. Using formula invoke tidyselect, e.g. modify_*(all_stat_cols() ~ \"**{level}**\"). dynamic dots allow syntax like modify_header(x, !!!list(label = \"Variable\")). See examples . Use show_header_names() see column names can modified. text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}. update, quiet include_example","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify column headers, footnotes, and spanning headers — modify","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"tbl-summary-tbl-svysummary-and-tbl-cross-","dir":"Reference","previous_headings":"","what":"tbl_summary(), tbl_svysummary(), and tbl_cross()","title":"Modify column headers, footnotes, and spanning headers — modify","text":"assigning column headers spanning headers, may use {N} insert number observations. tbl_svysummary objects additionally {N_unweighted} available. stratifying = argument present, following fields additionally available stratifying columns: {level}, {n}, {p} ({n_unweighted} {p_unweighted} tbl_svysummary objects) Syntax follows glue::glue(), e.g. all_stat_cols() ~ \"**{level}**, N = {n}\".","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"tbl-regression-","dir":"Reference","previous_headings":"","what":"tbl_regression()","title":"Modify column headers, footnotes, and spanning headers — modify","text":"assigning column headers tbl_regression tables, may use {N} insert number observations, {N_event} number events (applicable).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Modify column headers, footnotes, and spanning headers — modify","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify column headers, footnotes, and spanning headers — modify","text":"","code":"# create summary table tbl <- trial |> tbl_summary(by = trt, missing = \"no\", include = c(\"age\", \"grade\", \"trt\")) |> add_p() # print the column names that can be modified show_header_names(tbl) #> Column Name Header level* N* n* p* #> label \"**Characteristic**\" 200 #> stat_1 \"**Drug A** \\nN = 98\" Drug A 200 98 0.490 #> stat_2 \"**Drug B** \\nN = 102\" Drug B 200 102 0.510 #> p.value \"**p-value**\" 200 #> #> * These values may be dynamically placed into headers (and other locations). #> ℹ Review the `modify_header()` (`?gtsummary::modify_header()`) help for #> examples. # Example 1 ---------------------------------- # updating column headers tbl |> modify_header(label = \"**Variable**\", p.value = \"**P**\") Variable Drug A N = 981 Drug B N = 1021 P2 Age 46 (37, 60) 48 (39, 56) 0.7Grade 0.9    I 35 (36%) 33 (32%)     II 32 (33%) 36 (35%)     III 31 (32%) 33 (32%) 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test; Pearson’s Chi-squared test # Example 2 ---------------------------------- # updating headers add spanning header tbl |> modify_header(all_stat_cols() ~ \"**{level}**, N = {n} ({style_percent(p)}%)\") |> modify_spanning_header(all_stat_cols() ~ \"**Treatment Received**\") Characteristic Treatment Received p-value2 Drug A, N = 98 (49%)1 Drug B, N = 102 (51%)1 Age 46 (37, 60) 48 (39, 56) 0.7Grade 0.9    I 35 (36%) 33 (32%)     II 32 (33%) 36 (35%)     III 31 (32%) 33 (32%) 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test; Pearson’s Chi-squared test # Example 3 ---------------------------------- # updating an abbreviation in table footnote glm(response ~ age + grade, trial, family = binomial) |> tbl_regression(exponentiate = TRUE) |> modify_abbreviation(\"CI = Credible Interval\") Characteristic OR 95% CI p-value Age 1.02 1.00, 1.04 0.10Grade     I — —     II 0.85 0.39, 1.85 0.7    III 1.01 0.47, 2.16 >0.9Abbreviations: CI = Confidence Interval, CI = Credible Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Abbreviations — modify_abbreviation","title":"Modify Abbreviations — modify_abbreviation","text":"abbreviations coalesced printing final table single source note.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Abbreviations — modify_abbreviation","text":"","code":"modify_abbreviation(x, abbreviation, text_interpret = c(\"md\", \"html\")) remove_abbreviation(x, abbreviation)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Abbreviations — modify_abbreviation","text":"x (gtsummary) gtsummary object abbreviation (string) string text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify Abbreviations — modify_abbreviation","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify Abbreviations — modify_abbreviation","text":"","code":"# Example 1 ---------------------------------- tbl_summary( trial, by = trt, include = age, type = age ~ \"continuous2\" ) |> modify_table_body(~dplyr::mutate(.x, label = sub(\"Q1, Q3\", \"IQR\", x = label))) |> modify_abbreviation(\"IQR = Interquartile Range\") Characteristic Drug A N = 98 Drug B N = 102 Age     Median (IQR) 46 (37, 60) 48 (39, 56)    Unknown 7 4Abbreviation: IQR = Interquartile Range # Example 2 ---------------------------------- lm(marker ~ trt, trial) |> tbl_regression() |> remove_abbreviation(\"CI = Confidence Interval\") Characteristic Beta 95% CI p-value Chemotherapy Treatment     Drug A — —     Drug B -0.20 -0.44, 0.05 0.12"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify table caption — modify_caption","title":"Modify table caption — modify_caption","text":"Captions assigned based output type. gt::gt(caption=) flextable::set_caption(caption=) huxtable::set_caption(value=) knitr::kable(caption=)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify table caption — modify_caption","text":"","code":"modify_caption(x, caption, text_interpret = c(\"md\", \"html\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify table caption — modify_caption","text":"x (gtsummary) gtsummary object caption (string) string table caption/title text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify table caption — modify_caption","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify table caption — modify_caption","text":"Baseline Characteristics N = 200","code":"trial |> tbl_summary(by = trt, include = c(marker, stage)) |> modify_caption(caption = \"**Baseline Characteristics** N = {N}\") Baseline Characteristics N = 200 Characteristic Drug A N = 981 Drug B N = 1021 Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21)    Unknown 6 4T Stage     T1 28 (29%) 25 (25%)    T2 25 (26%) 29 (28%)    T3 22 (22%) 21 (21%)    T4 23 (23%) 27 (26%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_alignment.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify column alignment — modify_column_alignment","title":"Modify column alignment — modify_column_alignment","text":"Update column alignment/justification gtsummary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_alignment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify column alignment — modify_column_alignment","text":"","code":"modify_column_alignment(x, columns, align = c(\"left\", \"right\", \"center\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_alignment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify column alignment — modify_column_alignment","text":"x (gtsummary) gtsummary object columns (tidy-select) Selector columns x$table_body align (string) String indicating alignment column, must one c(\"left\", \"right\", \"center\")","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_alignment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify column alignment — modify_column_alignment","text":"","code":"# Example 1 ---------------------------------- lm(age ~ marker + grade, trial) %>% tbl_regression() %>% modify_column_alignment(columns = everything(), align = \"left\") Characteristic Beta 95% CI p-value Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9Grade     I — —     II 0.64 -4.7, 6.0 0.8    III 2.4 -2.8, 7.6 0.4Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify hidden columns — modify_column_hide","title":"Modify hidden columns — modify_column_hide","text":"Use functions hide unhide columns gtsummary table. Use show_header_names(show_hidden=TRUE) print available columns update.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify hidden columns — modify_column_hide","text":"","code":"modify_column_hide(x, columns) modify_column_unhide(x, columns)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify hidden columns — modify_column_hide","text":"x (gtsummary) gtsummary object columns (tidy-select) Selector columns x$table_body","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Modify hidden columns — modify_column_hide","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify hidden columns — modify_column_hide","text":"","code":"# Example 1 ---------------------------------- # hide 95% CI, and replace with standard error lm(age ~ marker + grade, trial) |> tbl_regression() |> modify_column_hide(conf.low) |> modify_column_unhide(columns = std.error) Characteristic Beta SE p-value Marker Level (ng/mL) -0.04 1.28 >0.9Grade     I — —     II 0.64 2.70 0.8    III 2.4 2.64 0.4Abbreviations: CI = Confidence Interval, SE = Standard Error"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify column indentation — modify_column_indent","title":"Modify column indentation — modify_column_indent","text":"Add, increase, reduce indentation columns.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify column indentation — modify_column_indent","text":"","code":"modify_column_indent(x, columns, rows = NULL, indent = 4L, double_indent, undo)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify column indentation — modify_column_indent","text":"x (gtsummary) gtsummary object columns (tidy-select) Selector columns x$table_body rows (predicate expression) Predicate expression select rows x$table_body. Can used style footnote, formatting functions, missing symbols, text formatting. Default NULL. See details . indent (integer) integer indicating many space indent text double_indent, undo","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify column indentation — modify_column_indent","text":"gtsummary table","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify column indentation — modify_column_indent","text":"","code":"# remove indentation from `tbl_summary()` trial |> tbl_summary(include = grade) |> modify_column_indent(columns = label, indent = 0L) Characteristic N = 2001 Grade I 68 (34%)II 68 (34%)III 64 (32%)1 n (%) # increase indentation in `tbl_summary` trial |> tbl_summary(include = grade) |> modify_column_indent(columns = label, rows = !row_type %in% 'label', indent = 8L) Characteristic N = 2001 Grade         I 68 (34%)        II 68 (34%)        III 64 (32%)1 n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Column Merging — modify_column_merge","title":"Modify Column Merging — modify_column_merge","text":"Merge two columns gtsummary table. Use show_header_names() print underlying column names.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Column Merging — modify_column_merge","text":"","code":"modify_column_merge(x, pattern, rows = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Column Merging — modify_column_merge","text":"x (gtsummary) gtsummary object pattern glue syntax string indicating merge columns x$table_body. example, construct confidence interval use \"{conf.low}, {conf.high}\". rows (predicate expression) Predicate expression select rows x$table_body. Can used style footnote, formatting functions, missing symbols, text formatting. Default NULL. See details .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify Column Merging — modify_column_merge","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify Column Merging — modify_column_merge","text":"Calling function merely records instructions merge columns. actual merging occurs gtsummary table printed converted function like as_gt(). column merging delayed, recommended perform major modifications table, tbl_merge() tbl_stack(), assigning merging instructions. Otherwise, unexpected formatting may occur final table. functionality used conjunction tbl_stack() (includes tbl_uvregression()), may potential issues printing. columns stack column-merging defined quosure, may run issues due loss environment 2 quosures combined. expression version quosure quosure (.e. evaluated objects), issues. function used internally care, recommended users.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"future-updates","dir":"Reference","previous_headings":"","what":"Future Updates","title":"Modify Column Merging — modify_column_merge","text":"planned updates implementation function respect pattern= argument. Currently, function replaces numeric column formatted character column following pattern=. gt::cols_merge() gains rows= argument implementation updated use , keep numeric columns numeric. vast majority users, planned change go unnoticed.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify Column Merging — modify_column_merge","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, missing = \"no\", include = c(age, marker, trt)) |> add_p(all_continuous() ~ \"t.test\", pvalue_fun = label_style_pvalue(prepend_p = TRUE)) |> modify_fmt_fun(statistic ~ label_style_sigfig()) |> modify_column_merge(pattern = \"t = {statistic}; {p.value}\") |> modify_header(statistic = \"**t-test**\") Characteristic Drug A N = 981 Drug B N = 1021 t-test2 Age 46 (37, 60) 48 (39, 56) t = -0.21; p=0.8Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) t = 1.6; p=0.121 Median (Q1, Q3) 2 Welch Two Sample t-test # Example 2 ---------------------------------- lm(marker ~ age + grade, trial) |> tbl_regression() |> modify_column_merge( pattern = \"{estimate} ({conf.low}, {conf.high})\", rows = !is.na(estimate) ) Characteristic Beta p-value Age 0.00 (-0.01, 0.01) >0.9Grade     I —     II -0.38 (-0.69, -0.07) 0.015    III -0.12 (-0.43, 0.19) 0.5Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify formatting functions — modify_fmt_fun","title":"Modify formatting functions — modify_fmt_fun","text":"Use function update way numeric columns rows .$table_body formatted","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify formatting functions — modify_fmt_fun","text":"","code":"modify_fmt_fun(x, ..., rows = NULL, update, quiet)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify formatting functions — modify_fmt_fun","text":"x (gtsummary) gtsummary object ... dynamic-dots Used assign updates formatting functions. Use modify_fmt_fun(colname = ) update single column. Using formula invoke tidyselect, e.g. modify_fmt_fun(c(estimate, conf.low, conf.high) ~ ). Use show_header_names() see column names can modified. rows (predicate expression) Predicate expression select rows x$table_body. Can used style footnote, formatting functions, missing symbols, text formatting. Default NULL. See details . update, quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":"rows-argument","dir":"Reference","previous_headings":"","what":"rows argument","title":"Modify formatting functions — modify_fmt_fun","text":"rows argument accepts predicate expression used specify rows apply formatting. expression must evaluate logical evaluated x$table_body. example, apply formatting age rows pass rows = variable == \"age\". vector row numbers acceptable. couple things note using rows argument. can use saved objects create predicate argument, e.g. rows = variable == letters[1]. saved object share name column x$table_body. reason tbl_merge() columns renamed, renaming process disambiguate variable column external object named variable following expression rows = .data$variable = .env$variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify formatting functions — modify_fmt_fun","text":"","code":"# Example 1 ---------------------------------- # show 'grade' p-values to 3 decimal places and estimates to 4 sig figs lm(age ~ marker + grade, trial) |> tbl_regression() %>% modify_fmt_fun( p.value = label_style_pvalue(digits = 3), c(estimate, conf.low, conf.high) ~ label_style_sigfig(digits = 4), rows = variable == \"grade\" ) Characteristic Beta 95% CI p-value Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9Grade     I — —     II 0.6365 -4.684, 5.957 0.814    III 2.394 -2.822, 7.610 0.366Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Footnotes — modify_footnote2","title":"Modify Footnotes — modify_footnote2","text":"Modify Footnotes","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Footnotes — modify_footnote2","text":"","code":"modify_footnote_header( x, footnote, columns, replace = TRUE, text_interpret = c(\"md\", \"html\") ) modify_footnote_body( x, footnote, columns, rows, replace = TRUE, text_interpret = c(\"md\", \"html\") ) remove_footnote_header(x, columns) remove_footnote_body(x, columns, rows)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Footnotes — modify_footnote2","text":"x (gtsummary) gtsummary object footnote (string) string columns (tidy-select) columns add footnote replace (scalar logical) Logical indicating whether replace existing footnotes specified location specified footnote, whether specified added existing footnote(s) header/cell. Default replace existing footnotes. text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}. rows (predicate expression) Predicate expression select rows x$table_body. Review rows argument details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify Footnotes — modify_footnote2","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify Footnotes — modify_footnote2","text":"","code":"# Example 1 ---------------------------------- tbl <- trial |> tbl_summary(by = trt, include = c(age, grade), missing = \"no\") |> modify_footnote_header( footnote = \"All but four subjects received both treatments in a crossover design\", columns = all_stat_cols(), replace = FALSE ) |> modify_footnote_body( footnote = \"Tumor grade was assessed _before_ treatment began\", columns = \"label\", rows = variable == \"grade\" & row_type == \"label\" ) tbl Characteristic Drug A N = 981,2 Drug B N = 1021,2 Age 46 (37, 60) 48 (39, 56)Grade3     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)1 Median (Q1, Q3); n (%) 2 All but four subjects received both treatments in a crossover design 3 Tumor grade was assessed before treatment began # Example 2 ---------------------------------- # remove all footnotes tbl |> remove_footnote_header(columns = all_stat_cols()) |> remove_footnote_body(columns = label, rows = variable == \"grade\" & row_type == \"label\") Characteristic Drug A N = 98 Drug B N = 102 Age 46 (37, 60) 48 (39, 56)Grade     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify source note — modify_source_note","title":"Modify source note — modify_source_note","text":"Add remove source notes table. Source notes similar footnotes, expect linked cell table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify source note — modify_source_note","text":"","code":"modify_source_note(x, source_note, text_interpret = c(\"md\", \"html\")) remove_source_note(x, source_note_id)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify source note — modify_source_note","text":"x (gtsummary) gtsummary object. source_note (string) string add source note. text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}. source_note_id (integers) Integers specifying ID source note remove. Source notes indexed sequentially time creation.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify source note — modify_source_note","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify source note — modify_source_note","text":"Source notes supported as_kable_extra().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify source note — modify_source_note","text":"","code":"# Example 1 ---------------------------------- tbl <- tbl_summary(trial, include = c(marker, grade), missing = \"no\") |> modify_source_note(\"Results as of June 26, 2015\") # Example 2 ---------------------------------- remove_source_note(tbl, source_note_id = 1) Characteristic N = 2001 Marker Level (ng/mL) 0.64 (0.22, 1.41)Grade     I 68 (34%)    II 68 (34%)    III 64 (32%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Table Body — modify_table_body","title":"Modify Table Body — modify_table_body","text":"Function advanced manipulation gtsummary tables. allow users modify .$table_body data frame included gtsummary object. new column added table, default printing instructions added .$table_styling. default, columns hidden. show column, add column header modify_header() call modify_column_unhide().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Table Body — modify_table_body","text":"","code":"modify_table_body(x, fun, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Table Body — modify_table_body","text":"x (gtsummary) 'gtsummary' object fun (function) function formula. function, used . formula, e.g. fun = ~ .x |> arrange(variable), converted function. argument passed fun x$table_body. ... Additional arguments passed function","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify Table Body — modify_table_body","text":"'gtsummary' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify Table Body — modify_table_body","text":"","code":"# Example 1 -------------------------------- # Add number of cases and controls to regression table trial |> tbl_uvregression( y = response, include = c(age, marker), method = glm, method.args = list(family = binomial), exponentiate = TRUE, hide_n = TRUE ) |> # adding number of non-events to table modify_table_body( ~ .x %>% dplyr::mutate(N_nonevent = N_obs - N_event) |> dplyr::relocate(c(N_event, N_nonevent), .before = estimate) ) |> # assigning header labels modify_header(N_nonevent = \"**Control N**\", N_event = \"**Case N**\") |> modify_fmt_fun(c(N_event, N_nonevent) ~ style_number) Characteristic Case N Control N OR 95% CI p-value Age 58 125 1.02 1.00, 1.04 0.10Marker Level (ng/mL) 57 126 1.35 0.94, 1.93 0.10Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Table Styling — modify_table_styling","title":"Modify Table Styling — modify_table_styling","text":"function developers. developer, recommended use following functions make modifications table. modify_header(), modify_spanning_header(), [modify_column_hide()], modify_column_unhide(), modify_footnote_header(), modify_footnote_body(), modify_abbreviation(), modify_column_alignment(), modify_fmt_fun(), [modify_column_indent()], modify_column_merge(). function meant advanced users gain control characteristics resulting gtsummary table directly modifying .$table_styling. function little checking passed arguments. Review gtsummary definition vignette information .$table_styling objects.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Table Styling — modify_table_styling","text":"","code":"modify_table_styling( x, columns, rows = NULL, label = NULL, spanning_header = NULL, hide = NULL, footnote = NULL, footnote_abbrev = NULL, align = NULL, missing_symbol = NULL, fmt_fun = NULL, text_format = NULL, undo_text_format = NULL, indent = NULL, text_interpret = \"md\", cols_merge_pattern = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Table Styling — modify_table_styling","text":"x (gtsummary) gtsummary object columns (tidy-select) Selector columns x$table_body rows (predicate expression) Predicate expression select rows x$table_body. Can used style footnote, formatting functions, missing symbols, text formatting. Default NULL. See details . label (character) Character vector column label(s). Must length columns. spanning_header (string) string text spanning header hide (scalar logical) Logical indicating whether hide column output footnote (string) string text footnote footnote_abbrev (string) string abbreviation definition, e.g. \"CI = Confidence Interval\" align (string) String indicating alignment column, must one c(\"left\", \"right\", \"center\") missing_symbol (string) string indicating missing values formatted. fmt_fun (function) function formats statistics columns/rows columns rows text_format, undo_text_format (string) String indicated type text formatting apply/remove rows columns. Must one c(\"bold\", \"italic\"). indent (integer) integer indicating many space indent text text_interpret (string) Must one \"md\" \"html\" indicates processing function gt::md() gt::html(). Use conjunction arguments header footnotes. cols_merge_pattern (string) glue-syntax string indicating merge columns x$table_body. example, construct confidence interval use \"{conf.low}, {conf.high}\". first column listed pattern string must match single column name passed columns=.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":"rows-argument","dir":"Reference","previous_headings":"","what":"rows argument","title":"Modify Table Styling — modify_table_styling","text":"rows argument accepts predicate expression used specify rows apply formatting. expression must evaluate logical evaluated x$table_body. example, apply formatting age rows pass rows = variable == \"age\". vector row numbers acceptable. couple things note using rows argument. can use saved objects create predicate argument, e.g. rows = variable == letters[1]. saved object share name column x$table_body. reason tbl_merge() columns renamed, renaming process disambiguate variable column external object named variable following expression rows = .data$variable = .env$variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":"cols-merge-pattern-argument","dir":"Reference","previous_headings":"","what":"cols_merge_pattern argument","title":"Modify Table Styling — modify_table_styling","text":"planned updates implementation column merging. Currently, function replaces numeric column formatted character column following cols_merge_pattern=. gt::cols_merge() gains rows= argument implementation updated use , keep numeric columns numeric. vast majority users, planned change go unnoticed. functionality used conjunction tbl_stack() (includes tbl_uvregression()), potential issue printing. columns stack column-merging defined quosure, may run issues due loss environment 2 quosures combined. expression version quosure quosure (.e. evaluated objects), issues. Regardless, argument used internally care, recommended users.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Regression Coefficients — plot","title":"Plot Regression Coefficients — plot","text":"plot() function extracts x$table_body passes ggstats::ggcoef_plot() along formatting options.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Regression Coefficients — plot","text":"","code":"# S3 method for class 'tbl_regression' plot(x, remove_header_rows = TRUE, remove_reference_rows = FALSE, ...) # S3 method for class 'tbl_uvregression' plot(x, remove_header_rows = TRUE, remove_reference_rows = FALSE, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Regression Coefficients — plot","text":"x (tbl_regression, tbl_uvregression) 'tbl_regression' 'tbl_uvregression' object remove_header_rows (scalar logical) logical indicating whether remove header rows categorical variables. Default TRUE remove_reference_rows (scalar logical) logical indicating whether remove reference rows categorical variables. Default FALSE. ... arguments passed ggstats::ggcoef_plot(...)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot Regression Coefficients — plot","text":"ggplot","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Regression Coefficients — plot","text":"","code":"glm(response ~ marker + grade, trial, family = binomial) |> tbl_regression( add_estimate_to_reference_rows = TRUE, exponentiate = TRUE ) |> plot()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/print_gtsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"print and knit_print methods for gtsummary objects — print_gtsummary","title":"print and knit_print methods for gtsummary objects — print_gtsummary","text":"print knit_print methods gtsummary objects","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/print_gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print and knit_print methods for gtsummary objects — print_gtsummary","text":"","code":"# S3 method for class 'gtsummary' print( x, print_engine = c(\"gt\", \"flextable\", \"huxtable\", \"kable\", \"kable_extra\", \"tibble\"), ... ) # S3 method for class 'gtsummary' knit_print( x, print_engine = c(\"gt\", \"flextable\", \"huxtable\", \"kable\", \"kable_extra\", \"tibble\"), ... ) pkgdown_print.gtsummary(x, visible = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/print_gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print and knit_print methods for gtsummary objects — print_gtsummary","text":"x object created using gtsummary functions print_engine String indicating print method. Must one \"gt\", \"kable\", \"kable_extra\", \"flextable\", \"tibble\" ... used","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/print_gtsummary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print and knit_print methods for gtsummary objects — print_gtsummary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize a proportion — proportion_summary","title":"Summarize a proportion — proportion_summary","text":"helper, used tbl_custom_summary(), creates function computing proportion confidence interval.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize a proportion — proportion_summary","text":"","code":"proportion_summary( variable, value, weights = NULL, na.rm = TRUE, conf.level = 0.95, method = c(\"wilson\", \"wilson.no.correct\", \"wald\", \"wald.no.correct\", \"exact\", \"agresti.coull\", \"jeffreys\") )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize a proportion — proportion_summary","text":"variable (string) String indicating name variable proportion computed. value (scalar) Value (list values) variable taken account numerator. weights (string) Optional string indicating name frequency weighting variable. NULL, observations assumed weight equal 1. na.rm (scalar logical) missing values removed computing proportion? (default TRUE) conf.level (scalar numeric) Confidence level returned confidence interval. Must strictly greater 0 less 1. Default 0.95, corresponds 95 percent confidence interval. method (string) Confidence interval method. Must one c(\"wilson\", \"wilson..correct\", \"wald\", \"wald..correct\", \"exact\", \"agresti.coull\", \"jeffreys\"). See add_ci() details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Summarize a proportion — proportion_summary","text":"Computed statistics: {n} numerator, number observations equal values {N} denominator, number observations {prop} proportion, .e. n/N {conf.low} lower confidence interval {conf.high} upper confidence interval Methods c(\"wilson\", \"wilson..correct\") calculated stats::prop.test() (correct = c(TRUE, FALSE)). default method, \"wilson\", includes Yates continuity correction. Methods c(\"exact\", \"asymptotic\") calculated Hmisc::binconf() corresponding method.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summarize a proportion — proportion_summary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize a proportion — proportion_summary","text":"","code":"# Example 1 ---------------------------------- Titanic |> as.data.frame() |> tbl_custom_summary( include = c(\"Age\", \"Class\"), by = \"Sex\", stat_fns = ~ proportion_summary(\"Survived\", \"Yes\", weights = \"Freq\"), statistic = ~ \"{prop}% ({n}/{N}) [{conf.low}-{conf.high}]\", digits = ~ list( prop = label_style_percent(digits = 1), n = 0, N = 0, conf.low = label_style_percent(), conf.high = label_style_percent() ), overall_row = TRUE, overall_row_last = TRUE ) |> bold_labels() |> modify_footnote_header(\"Proportion (%) of survivors (n/N) [95% CI]\", columns = all_stat_cols()) Characteristic Male N = 161 Female N = 161 Age     Child 45.3% (29/64) [33-58] 62.2% (28/45) [47-76]    Adult 20.3% (338/1,667) [18-22] 74.4% (316/425) [70-78]Class     1st 34.4% (62/180) [28-42] 97.2% (141/145) [93-99]    2nd 14.0% (25/179) [9.4-20] 87.7% (93/106) [80-93]    3rd 17.3% (88/510) [14-21] 45.9% (90/196) [39-53]    Crew 22.3% (192/862) [20-25] 87.0% (20/23) [65-97]Overall 21.2% (367/1,731) [19-23] 73.2% (344/470) [69-77]1 Proportion (%) of survivors (n/N) [95% CI]"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize the ratio of two variables — ratio_summary","title":"Summarize the ratio of two variables — ratio_summary","text":"helper, used tbl_custom_summary(), creates function computing ratio two continuous variables confidence interval.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize the ratio of two variables — ratio_summary","text":"","code":"ratio_summary(numerator, denominator, na.rm = TRUE, conf.level = 0.95)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize the ratio of two variables — ratio_summary","text":"numerator (string) String indicating name variable summed computing numerator. denominator (string) String indicating name variable summed computing denominator. na.rm (scalar logical) missing values removed summing numerator denominator? (default TRUE) conf.level (scalar numeric) Confidence level returned confidence interval. Must strictly greater 0 less 1. Default 0.95, corresponds 95 percent confidence interval.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Summarize the ratio of two variables — ratio_summary","text":"Computed statistics: {num} sum variable defined numerator {denom} sum variable defined denominator {ratio} ratio num denom {conf.low} lower confidence interval {conf.high} upper confidence interval Confidence interval computed stats::poisson.test(), num integer.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summarize the ratio of two variables — ratio_summary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize the ratio of two variables — ratio_summary","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_custom_summary( include = c(\"stage\", \"grade\"), by = \"trt\", stat_fns = ~ ratio_summary(\"response\", \"ttdeath\"), statistic = ~\"{ratio} [{conf.low}; {conf.high}] ({num}/{denom})\", digits = ~ c(ratio = 3, conf.low = 2, conf.high = 2), overall_row = TRUE, overall_row_label = \"All stages & grades\" ) |> bold_labels() |> modify_footnote_header(\"Ratio [95% CI] (n/N)\", columns = all_stat_cols()) Characteristic Drug A N = 981 Drug B N = 1021 All stages & grades 0.014 [0.01; 0.02] (28.0000/1,983.0000) 0.017 [0.01; 0.02] (33.0000/1,941.6100)T Stage     T1 0.012 [0.00; 0.02] (7/583) 0.021 [0.01; 0.04] (11/522)    T2 0.011 [0.00; 0.02] (6/528) 0.012 [0.01; 0.03] (7/560)    T3 0.019 [0.01; 0.04] (8/426) 0.016 [0.01; 0.03] (7/425)    T4 0.016 [0.01; 0.03] (7/445) 0.018 [0.01; 0.04] (8/434)Grade     I 0.011 [0.00; 0.02] (8/734) 0.019 [0.01; 0.03] (13/690)    II 0.011 [0.00; 0.02] (7/651) 0.019 [0.01; 0.03] (12/645)    III 0.022 [0.01; 0.04] (13/598) 0.013 [0.01; 0.03] (8/607)1 Ratio [95% CI] (n/N)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. dplyr %>%, all_of, any_of, as_tibble, contains, ends_with, everything, last_col, matches, mutate, num_range, one_of, select, starts_with, vars, ","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove rows — remove_row_type","title":"Remove rows — remove_row_type","text":"Removes either header, reference, missing rows gtsummary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove rows — remove_row_type","text":"","code":"remove_row_type( x, variables = everything(), type = c(\"header\", \"reference\", \"missing\", \"level\", \"all\"), level_value = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove rows — remove_row_type","text":"x (gtsummary) gtsummary object variables (tidy-select) Variables remove rows . Default everything() type (string) Type row remove. Must one c(\"header\", \"reference\", \"missing\", \"level\", \"\") level_value (string) type='level' can specify character value level remove. NULL levels removed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove rows — remove_row_type","text":"Modified gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove rows — remove_row_type","text":"","code":"# Example 1 ---------------------------------- trial |> dplyr::mutate( age60 = ifelse(age < 60, \"<60\", \"60+\") ) |> tbl_summary(by = trt, missing = \"no\", include = c(trt, age, age60)) |> remove_row_type(age60, type = \"header\") Characteristic Drug A N = 981 Drug B N = 1021 Age 46 (37, 60) 48 (39, 56)    60+ 23 (25%) 18 (18%)    <60 68 (75%) 80 (82%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/rows_argument.html","id":null,"dir":"Reference","previous_headings":"","what":"rows argument — rows_argument","title":"rows argument — rows_argument","text":"rows argument accepts predicate expression used specify rows apply formatting. expression must evaluate logical evaluated x$table_body. example, apply formatting age rows pass rows = variable == \"age\". vector row numbers acceptable. couple things note using rows argument. can use saved objects create predicate argument, e.g. rows = variable == letters[1]. saved object share name column x$table_body. reason tbl_merge() columns renamed, renaming process disambiguate variable column external object named variable following expression rows = .data$variable = .env$variable.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"scope-table-body-","dir":"Reference","previous_headings":"","what":"scope_table_body()","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"function uses information .$table_body adds attributes data (passed). assigned proper gtsummary attributes, gtsummary selectors like all_continuous() work properly. Columns c(\"var_type\", \"test_name\", \"contrasts_type\") columns begin \"selector_*\" scoped. values columns added attributes data frame. example, var_type='continuous' variable \"age\", attribute attr(.$age, 'gtsummary.var_type') <- 'continuous' set. attribute used selector like all_continuous().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"scope-header-","dir":"Reference","previous_headings":"","what":"scope_header()","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"function takes information .$table_styling$header adds table_body. Columns begin 'modify_selector_' hide column.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"","code":"scope_table_body(table_body, data = NULL) scope_header(table_body, header = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"table_body data frame .$table_body data optional data frame attributes added header header data frame .$table_styling$header","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"data frame","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"","code":"tbl <- tbl_summary(trial, include = c(age, grade)) scope_table_body(tbl$table_body) |> select(all_continuous()) |> names() #> [1] \"age\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"Select helper functions — select_helpers","title":"Select helper functions — select_helpers","text":"Set functions supplement {tidyselect} set functions selecting columns data frames (items well). all_continuous() selects continuous variables all_continuous2() selects type \"continuous2\" all_categorical() selects categorical (including \"dichotomous\") variables all_dichotomous() selects type \"dichotomous\" all_tests() selects variables name test performed all_stat_cols() selects columns tbl_summary/tbl_svysummary object summary statistics (.e. \"stat_0\", \"stat_1\", \"stat_2\", etc.) all_interaction() selects interaction terms regression model all_intercepts() selects intercept terms regression model all_contrasts() selects variables regression model based type contrast","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Select helper functions — select_helpers","text":"","code":"all_continuous(continuous2 = TRUE) all_continuous2() all_categorical(dichotomous = TRUE) all_dichotomous() all_tests(tests) all_intercepts() all_interaction() all_contrasts( contrasts_type = c(\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdif\", \"other\") ) all_stat_cols(stat_0 = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Select helper functions — select_helpers","text":"continuous2 (scalar logical) Logical indicating whether include continuous2 variables. Default TRUE dichotomous (scalar logical) Logical indicating whether include dichotomous variables. Default TRUE tests (character) character vector indicating test type variables select, e.g. select variables compared \"t.test\". contrasts_type (character) type contrast select. Select among contrast types c(\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdif\", \"\"). Default contrast types. stat_0 (scalar logical) FALSE, select \"stat_0\" column. Default TRUE","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Select helper functions — select_helpers","text":"character vector column names selected","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Select helper functions — select_helpers","text":"","code":"select_ex1 <- trial |> select(age, response, grade) |> tbl_summary( statistic = all_continuous() ~ \"{mean} ({sd})\", type = all_dichotomous() ~ \"categorical\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/separate_p_footnotes.html","id":null,"dir":"Reference","previous_headings":"","what":"Create footnotes for individual p-values — separate_p_footnotes","title":"Create footnotes for individual p-values — separate_p_footnotes","text":"usual presentation footnotes p-values gtsummary table single footnote lists statistical tests used compute p-values given table. separate_p_footnotes() function separates aggregated p-value footnotes individual footnotes denote specific test used p-values.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/separate_p_footnotes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create footnotes for individual p-values — separate_p_footnotes","text":"","code":"separate_p_footnotes(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/separate_p_footnotes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create footnotes for individual p-values — separate_p_footnotes","text":"x (tbl_summary, tbl_svysummary) Object class \"tbl_summary\" \"tbl_svysummary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/separate_p_footnotes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create footnotes for individual p-values — separate_p_footnotes","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(age, grade)) |> add_p() |> separate_p_footnotes() Characteristic Drug A N = 981 Drug B N = 1021 p-value Age 46 (37, 60) 48 (39, 56) 0.72    Unknown 7 4 Grade 0.93    I 35 (36%) 33 (32%)     II 32 (33%) 36 (35%)     III 31 (32%) 33 (32%) 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test 3 Pearson’s Chi-squared test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":null,"dir":"Reference","previous_headings":"","what":"Set gtsummary theme — set_gtsummary_theme","title":"Set gtsummary theme — set_gtsummary_theme","text":"Functions set, reset, get, evaluate gtsummary themes. set_gtsummary_theme() set theme reset_gtsummary_theme() reset themes get_gtsummary_theme() get named list active theme elements with_gtsummary_theme() evaluate expression theme temporarily set check_gtsummary_theme() checks passed theme valid","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set gtsummary theme — set_gtsummary_theme","text":"","code":"set_gtsummary_theme(x, quiet) reset_gtsummary_theme() get_gtsummary_theme() with_gtsummary_theme( x, expr, env = rlang::caller_env(), msg_ignored_elements = NULL ) check_gtsummary_theme(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set gtsummary theme — set_gtsummary_theme","text":"x (named list) named list defining gtsummary theme. quiet expr (expression) Expression evaluated theme specified x= loaded env (environment) environment evaluate expr= msg_ignored_elements (string) Default NULL message printed. Pass string printed cli::cli_alert_info(). \"{elements}\" object contains vector theme elements overwritten ignored.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Set gtsummary theme — set_gtsummary_theme","text":"default formatting styling throughout gtsummary package taken published reporting guidelines top four urology journals: European Urology, Journal Urology, Urology British Journal Urology International. Use function change default reporting style match another journal, personal style.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set gtsummary theme — set_gtsummary_theme","text":"","code":"# Setting JAMA theme for gtsummary set_gtsummary_theme(theme_gtsummary_journal(\"jama\")) #> Setting theme \"JAMA\" #> Setting theme \"JAMA\" # Themes can be combined by including more than one set_gtsummary_theme(theme_gtsummary_compact()) #> Setting theme \"Compact\" #> Setting theme \"Compact\" set_gtsummary_theme_ex1 <- trial |> tbl_summary(by = trt, include = c(age, grade, trt)) |> add_stat_label() |> as_gt() #> `add_stat_label()` has previously been applied. Returning gtsummary table #> unaltered. # reset gtsummary theme reset_gtsummary_theme()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":null,"dir":"Reference","previous_headings":"","what":"Sort/filter by p-values — sort_filter_p","title":"Sort/filter by p-values — sort_filter_p","text":"Sort/filter p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sort/filter by p-values — sort_filter_p","text":"","code":"sort_p(x, q = FALSE) filter_p(x, q = FALSE, t = 0.05)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sort/filter by p-values — sort_filter_p","text":"x (gtsummary) object created using gtsummary functions q (scalar logical) TRUE check q-value column rather p-value. Default FALSE. t (scalar numeric) Threshold values retained. Default 0.05.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Sort/filter by p-values — sort_filter_p","text":"Karissa Whiting, Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sort/filter by p-values — sort_filter_p","text":"","code":"# Example 1 ---------------------------------- trial %>% select(age, grade, response, trt) %>% tbl_summary(by = trt) %>% add_p() %>% filter_p(t = 0.8) %>% sort_p() Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Tumor Response 28 (29%) 33 (34%) 0.5    Unknown 3 4 Age 46 (37, 60) 48 (39, 56) 0.7    Unknown 7 4 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test; Pearson’s Chi-squared test # Example 2 ---------------------------------- glm(response ~ trt + grade, trial, family = binomial(link = \"logit\")) %>% tbl_regression(exponentiate = TRUE) %>% sort_p() Characteristic OR 95% CI p-value Chemotherapy Treatment     Drug A — —     Drug B 1.21 0.66, 2.24 0.5Grade     I — —     II 0.94 0.44, 1.98 0.9    III 1.09 0.52, 2.27 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":null,"dir":"Reference","previous_headings":"","what":"Style numbers — style_number","title":"Style numbers — style_number","text":"Style numbers","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style numbers — style_number","text":"","code":"style_number( x, digits = 0, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), scale = 1, prefix = \"\", suffix = \"\", ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style numbers — style_number","text":"x (numeric) Numeric vector digits (non-negative integer) Integer vector integers specifying number decimals round x. vector passed, integer mapped 1:1 numeric values x big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") scale (scalar numeric) scaling factor: x multiplied scale formatting. prefix (string) Additional text display number. suffix (string) Additional text display number. ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style numbers — style_number","text":"formatted character vector","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style numbers — style_number","text":"","code":"c(0.111, 12.3) |> style_number(digits = 1) #> [1] \"0.1\" \"12.3\" c(0.111, 12.3) |> style_number(digits = c(1, 0)) #> [1] \"0.1\" \"12\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":null,"dir":"Reference","previous_headings":"","what":"Style percentages — style_percent","title":"Style percentages — style_percent","text":"Style percentages","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style percentages — style_percent","text":"","code":"style_percent( x, digits = 0, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", symbol, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style percentages — style_percent","text":"x numeric vector percentages digits number digits round large percentages (.e. greater 10%). Smaller percentages rounded digits + 1 places. Default 0 big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") prefix (string) Additional text display number. suffix (string) Additional text display number. symbol Logical indicator include percent symbol output. Default FALSE. ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style percentages — style_percent","text":"character vector styled percentages","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Style percentages — style_percent","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style percentages — style_percent","text":"","code":"percent_vals <- c(-1, 0, 0.0001, 0.005, 0.01, 0.10, 0.45356, 0.99, 1.45) style_percent(percent_vals) #> [1] NA \"0\" \"<0.1\" \"0.5\" \"1.0\" \"10\" \"45\" \"99\" \"145\" style_percent(percent_vals, suffix = \"%\", digits = 1) #> [1] NA \"0%\" \"0.01%\" \"0.50%\" \"1.00%\" \"10.0%\" \"45.4%\" \"99.0%\" #> [9] \"145.0%\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":null,"dir":"Reference","previous_headings":"","what":"Style p-values — style_pvalue","title":"Style p-values — style_pvalue","text":"Style p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style p-values — style_pvalue","text":"","code":"style_pvalue( x, digits = 1, prepend_p = FALSE, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style p-values — style_pvalue","text":"x (numeric) Numeric vector p-values. digits (integer) Number digits large p-values rounded. Must 1, 2, 3. Default 1. prepend_p (scalar logical) Logical. 'p=' prepended formatted p-value. Default FALSE big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style p-values — style_pvalue","text":"character vector styled p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Style p-values — style_pvalue","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style p-values — style_pvalue","text":"","code":"pvals <- c( 1.5, 1, 0.999, 0.5, 0.25, 0.2, 0.197, 0.12, 0.10, 0.0999, 0.06, 0.03, 0.002, 0.001, 0.00099, 0.0002, 0.00002, -1 ) style_pvalue(pvals) #> [1] NA \">0.9\" \">0.9\" \"0.5\" \"0.3\" \"0.2\" \"0.2\" \"0.12\" #> [9] \"0.10\" \"0.10\" \"0.060\" \"0.030\" \"0.002\" \"0.001\" \"<0.001\" \"<0.001\" #> [17] \"<0.001\" NA style_pvalue(pvals, digits = 2, prepend_p = TRUE) #> [1] NA \"p>0.99\" \"p>0.99\" \"p=0.50\" \"p=0.25\" \"p=0.20\" \"p=0.20\" #> [8] \"p=0.12\" \"p=0.10\" \"p=0.10\" \"p=0.060\" \"p=0.030\" \"p=0.002\" \"p=0.001\" #> [15] \"p<0.001\" \"p<0.001\" \"p<0.001\" NA"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":null,"dir":"Reference","previous_headings":"","what":"Style ratios — style_ratio","title":"Style ratios — style_ratio","text":"reporting ratios, relative risk odds ratio, often want rounding similar side number 1. example, report odds ratio 0.95 confidence interval 0.70 1.24, want round two decimal places values. words, 2 significant figures numbers less 1 3 significant figures 1 larger. style_ratio() performs significant figure-like rounding manner.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style ratios — style_ratio","text":"","code":"style_ratio( x, digits = 2, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style ratios — style_ratio","text":"x (numeric) Numeric vector digits (integer) Integer specifying number significant digits display numbers 1. Numbers larger 1 digits + 1. Default digits = 2. big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") prefix (string) Additional text display number. suffix (string) Additional text display number. ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style ratios — style_ratio","text":"character vector styled ratios","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Style ratios — style_ratio","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style ratios — style_ratio","text":"","code":"c(0.123, 0.9, 1.1234, 12.345, 101.234, -0.123, -0.9, -1.1234, -12.345, -101.234) |> style_ratio() #> [1] \"0.12\" \"0.90\" \"1.12\" \"12.3\" \"101\" \"-0.12\" \"-0.90\" \"-1.12\" \"-12.3\" #> [10] \"-101\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":null,"dir":"Reference","previous_headings":"","what":"Style significant figure-like rounding — style_sigfig","title":"Style significant figure-like rounding — style_sigfig","text":"Converts numeric argument string rounded significant figure-like number. Scientific notation output avoided, however, additional significant figures may displayed large numbers. example, number significant digits requested 2, 123 displayed (rather 120 1.2x10^2).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style significant figure-like rounding — style_sigfig","text":"","code":"style_sigfig( x, digits = 2, scale = 1, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style significant figure-like rounding — style_sigfig","text":"x Numeric vector digits Integer specifying minimum number significant digits display scale (scalar numeric) scaling factor: x multiplied scale formatting. big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") prefix (string) Additional text display number. suffix (string) Additional text display number. ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style significant figure-like rounding — style_sigfig","text":"character vector styled numbers","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Style significant figure-like rounding — style_sigfig","text":"Scientific notation output avoided. 2 significant figures requested, number rounded 2 decimal places. example, number rounded 2 decimals places abs(x) < 1, 1 decimal place abs(x) >= 1 & abs(x) < 10, nearest integer abs(x) >= 10. Additional significant figures may displayed large numbers. example, number significant digits requested 2, 123 displayed (rather 120 1.2x10^2).","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Style significant figure-like rounding — style_sigfig","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style significant figure-like rounding — style_sigfig","text":"","code":"c(0.123, 0.9, 1.1234, 12.345, -0.123, -0.9, -1.1234, -132.345, NA, -0.001) %>% style_sigfig() #> [1] \"0.12\" \"0.90\" \"1.1\" \"12\" \"-0.12\" \"-0.90\" \"-1.1\" \"-132\" NA #> [10] \"0.00\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/syntax.html","id":null,"dir":"Reference","previous_headings":"","what":"Syntax and Notation — syntax","title":"Syntax and Notation — syntax","text":"Syntax Notation","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/syntax.html","id":"selectors","dir":"Reference","previous_headings":"","what":"Selectors","title":"Syntax and Notation — syntax","text":"gtsummary package also utilizes selectors: selectors tidyselect package custom selectors. Review help files details. tidy selectors everything(), all_of(), any_of(), starts_with(), ends_with(), contains(), matches(), num_range(), last_col() gtsummary selectors all_continuous(), all_categorical(), all_dichotomous(), all_continuous2(), all_tests(), all_stat_cols(), all_interaction(), all_intercepts(), all_contrasts()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/syntax.html","id":"formula-and-list-selectors","dir":"Reference","previous_headings":"","what":"Formula and List Selectors","title":"Syntax and Notation — syntax","text":"Many arguments throughout gtsummary package accept list formula notation, e.g. tbl_summary(statistic=). enumerates tips shortcuts using list formulas. List Formulas Typical usage includes list formulas, LHS variable name selector. Named List may also pass named list; however, tidyselect gtsummary selectors supported syntax. Hybrid Named List/List Formulas Pass combination formulas named elements Shortcuts can pass single formula, equivalent passing formula list. shortcut select variables, can omit LHS formula. two calls equivalent. Combination Selectors Selectors can combined using c() function.","code":"tbl_summary(statistic = list(age ~ \"{mean}\", all_categorical() ~ \"{n}\")) tbl_summary(statistic = list(age = \"{mean}\", response = \"{n}\")) tbl_summary(statistic = list(age = \"{mean}\", all_categorical() ~ \"{n}\")) tbl_summary(statistic = all_categorical() ~ \"{n}\") tbl_summary(statistic = ~\"{n}\") tbl_summary(statistic = everything() ~ \"{n}\") tbl_summary(statistic = c(everything(), -grade) ~ \"{n}\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize continuous variable — tbl_ard_continuous","title":"Summarize continuous variable — tbl_ard_continuous","text":"Summarize continuous variable one categorical variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize continuous variable — tbl_ard_continuous","text":"","code":"tbl_ard_continuous( cards, variable, include, by = NULL, label = NULL, statistic = everything() ~ \"{median} ({p25}, {p75})\", value = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize continuous variable — tbl_ard_continuous","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. variable (string) single variable name continuous variable summarized. include (character) Character vector categorical variables (string) single variable name stratifying variable. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (formula-list-selector) Specifies summary statistics display variable. default everything() ~ \"{median} ({p25}, {p75})\". value (formula-list-selector) Supply value display variable single row, printing results variable associated value (similar 'dichotomous' display tbl_summary()).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summarize continuous variable — tbl_ard_continuous","text":"gtsummary table class \"tbl_ard_summary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize continuous variable — tbl_ard_continuous","text":"","code":"library(cards) # Example 1 ---------------------------------- # the primary ARD with the results ard_continuous( # the order variables are passed is important for the `by` variable. # 'trt' is the column stratifying variable and needs to be listed first. trial, by = c(trt, grade), variables = age ) |> # adding OPTIONAL information about the summary variables bind_ard( # add univariate trt tabulation ard_categorical(trial, variables = trt), # add missing and attributes ARD ard_missing(trial, by = c(trt, grade), variables = age), ard_attributes(trial, variables = c(trt, grade, age)) ) |> tbl_ard_continuous(by = \"trt\", variable = \"age\", include = \"grade\") Characteristic Drug A1 Drug B1 Grade     I 46.0 (36.0, 60.0) 48.0 (42.0, 55.0)    II 44.5 (31.0, 55.0) 50.5 (42.0, 57.5)    III 51.5 (41.5, 60.5) 45.0 (36.0, 52.0)1 Age: Median (Q1, Q3) # Example 2 ---------------------------------- # the primary ARD with the results ard_continuous(trial, by = grade, variables = age) |> # adding OPTIONAL information about the summary variables bind_ard( # add missing and attributes ARD ard_missing(trial, by = grade, variables = age), ard_attributes(trial, variables = c(grade, age)) ) |> tbl_ard_continuous(variable = \"age\", include = \"grade\") Characteristic Overall1 Grade     I 47.0 (37.0, 56.0)    II 48.5 (37.0, 57.0)    III 47.0 (38.0, 58.0)1 Age: Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":null,"dir":"Reference","previous_headings":"","what":"ARD Hierarchical Table — tbl_ard_hierarchical","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"preview function. changes coming releases, changes undergo formal deprecation cycle. Constructs tables nested hierarchical data structures (e.g. adverse events).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"","code":"tbl_ard_hierarchical( cards, variables, by = NULL, include = everything(), statistic = ~\"{n} ({p}%)\", label = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. variables (tidy-select) character vector tidy-selector columns data used create hierarchy. Hierarchy built variables order given. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. include (tidy-select) variables hierarchy summary statistics returned (variable label rows) Including last element hierarchy effect since level row variable. default everything(). statistic (formula-list-selector) used specify summary statistics display variables tbl_hierarchical(). default everything() ~ \"{n} ({p})\". label (formula-list-selector) used override default labels hierarchical table, e.g. list(AESOC = \"System Organ Class\"). default variable column label attribute, attr(., 'label'). label set, column name used.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"gtsummary table class \"tbl_ard_hierarchical\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"","code":"ADAE_subset <- cards::ADAE |> dplyr::filter( AESOC %in% unique(cards::ADAE$AESOC)[1:5], AETERM %in% unique(cards::ADAE$AETERM)[1:5] ) # Example 1: Event Rates -------------------- # First, build the ARD ard <- cards::ard_stack_hierarchical( data = ADAE_subset, variables = c(AESOC, AETERM), by = TRTA, denominator = cards::ADSL |> mutate(TRTA = ARM), id = USUBJID ) # Second, build table from the ARD tbl_ard_hierarchical( cards = ard, variables = c(AESOC, AETERM), by = TRTA ) AESOC     AETERM Placebo N = 861 Xanomeline High Dose N = 841 Xanomeline Low Dose N = 841 CARDIAC DISORDERS 2 (2.3%) 3 (3.6%) 0 (0.0%)    ATRIOVENTRICULAR BLOCK SECOND DEGREE 2 (2.3%) 3 (3.6%) 0 (0.0%)GASTROINTESTINAL DISORDERS 9 (10.5%) 4 (4.8%) 5 (6.0%)    DIARRHOEA 9 (10.5%) 4 (4.8%) 5 (6.0%)GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS 8 (9.3%) 25 (29.8%) 24 (28.6%)    APPLICATION SITE ERYTHEMA 3 (3.5%) 15 (17.9%) 12 (14.3%)    APPLICATION SITE PRURITUS 6 (7.0%) 22 (26.2%) 22 (26.2%)SKIN AND SUBCUTANEOUS TISSUE DISORDERS 9 (10.5%) 14 (16.7%) 15 (17.9%)    ERYTHEMA 9 (10.5%) 14 (16.7%) 15 (17.9%)1 n (%) # Example 2: Event Counts ------------------- ard <- cards::ard_stack_hierarchical_count( data = ADAE_subset, variables = c(AESOC, AETERM), by = TRTA, denominator = cards::ADSL |> mutate(TRTA = ARM) ) tbl_ard_hierarchical( cards = ard, variables = c(AESOC, AETERM), by = TRTA, statistic = ~\"{n}\" ) AESOC     AETERM Placebo N = 861 Xanomeline High Dose N = 841 Xanomeline Low Dose N = 841 CARDIAC DISORDERS 2 4 0    ATRIOVENTRICULAR BLOCK SECOND DEGREE 2 4 0GASTROINTESTINAL DISORDERS 10 4 7    DIARRHOEA 10 4 7GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS 13 58 53    APPLICATION SITE ERYTHEMA 3 23 20    APPLICATION SITE PRURITUS 10 35 33SKIN AND SUBCUTANEOUS TISSUE DISORDERS 13 22 24    ERYTHEMA 13 22 241 n"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"ARD summary table — tbl_ard_summary","title":"ARD summary table — tbl_ard_summary","text":"tbl_ard_summary() function tables descriptive statistics continuous, categorical, dichotomous variables. functions accepts ARD object.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ARD summary table — tbl_ard_summary","text":"","code":"tbl_ard_summary( cards, by = NULL, statistic = list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"), type = NULL, label = NULL, missing = c(\"no\", \"ifany\", \"always\"), missing_text = \"Unknown\", missing_stat = \"{N_miss}\", include = everything(), overall = FALSE )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ARD summary table — tbl_ard_summary","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. (tidy-select) single column data. Summary statistics stratified variable. Default NULL statistic (formula-list-selector) Used specify summary statistics variable. statistics must present card new statistics calculated function. default list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"). type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). Continuous summaries may assigned c(\"continuous\", \"continuous2\"), categorical dichotomous modified. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"\", \"ifany\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss include (tidy-select) Variables include summary table. Default everything() overall (scalar logical) TRUE, cards input parsed two parts run tbl_ard_summary(cards_by) |> add_overall(cards_overall). Can used argument specified. Default FALSE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ARD summary table — tbl_ard_summary","text":"gtsummary table class \"tbl_ard_summary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"ARD summary table — tbl_ard_summary","text":"three types additional data can included ARD improve default appearance table. Attributes: attributes included, default labels variable labels, available. Attributes can included ARD cards::ard_attributes() ard_stack(.attributes = TRUE). Missing: missing results included, users can include missing counts rates variables tbl_ard_summary(missing = c(\"ifany\", \"always\")). missing statistics can included ARD cards::ard_missing() ard_stack(.missing = TRUE). Total N: total N saved internally available, can calculated cards::ard_total_n() ard_stack(.total_n = TRUE).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ARD summary table — tbl_ard_summary","text":"","code":"library(cards) ard_stack( data = ADSL, ard_categorical(variables = \"AGEGR1\"), ard_continuous(variables = \"AGE\"), .attributes = TRUE, .missing = TRUE, .total_n = TRUE ) |> tbl_ard_summary() Characteristic Overall1 Pooled Age Group 1     65-80 144 (56.7%)    <65 33 (13.0%)    >80 77 (30.3%)Age 77.0 (70.0, 81.0)1 n (%); Median (Q1, Q3) ard_stack( data = ADSL, .by = ARM, ard_categorical(variables = \"AGEGR1\"), ard_continuous(variables = \"AGE\"), .attributes = TRUE, .missing = TRUE, .total_n = TRUE ) |> tbl_ard_summary(by = ARM) Characteristic Placebo1 Xanomeline High Dose1 Xanomeline Low Dose1 Pooled Age Group 1     65-80 42 (48.8%) 55 (65.5%) 47 (56.0%)    <65 14 (16.3%) 11 (13.1%) 8 (9.5%)    >80 30 (34.9%) 18 (21.4%) 29 (34.5%)Age 76.0 (69.0, 82.0) 76.0 (70.5, 80.0) 77.5 (71.0, 82.0)1 n (%); Median (Q1, Q3) ard_stack( data = ADSL, .by = ARM, ard_categorical(variables = \"AGEGR1\"), ard_continuous(variables = \"AGE\"), .attributes = TRUE, .missing = TRUE, .total_n = TRUE, .overall = TRUE ) |> tbl_ard_summary(by = ARM, overall = TRUE) Characteristic Overall1 Placebo1 Xanomeline High Dose1 Xanomeline Low Dose1 Pooled Age Group 1     65-80 144 (56.7%) 42 (48.8%) 55 (65.5%) 47 (56.0%)    <65 33 (13.0%) 14 (16.3%) 11 (13.1%) 8 (9.5%)    >80 77 (30.3%) 30 (34.9%) 18 (21.4%) 29 (34.5%)Age 77.0 (70.0, 81.0) 76.0 (69.0, 82.0) 76.0 (70.5, 80.0) 77.5 (71.0, 82.0)1 n (%); Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide ARD summary table — tbl_ard_wide_summary","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"function similar tbl_ard_summary(), places summary statistics wide, separate columns. included variables must summary type, e.g. continuous summaries categorical summaries (encompasses dichotomous variables).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"","code":"tbl_ard_wide_summary( cards, statistic = switch(type[[1]], continuous = c(\"{median}\", \"{p25}, {p75}\"), c(\"{n}\", \"{p}%\")), type = NULL, label = NULL, value = NULL, include = everything() )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. statistic (character) character vector statistics present. element vector result column summary table. Default c(\"{median}\", \"{p25}, {p75}\") continuous summaries, c(\"{n}\", \"{p}%\") categorical/dichotomous summaries type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. include (tidy-select) Variables include summary table. Default everything().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"gtsummary table class 'tbl_wide_summary'","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"","code":"library(cards) ard_stack( trial, ard_continuous(variables = age), .missing = TRUE, .attributes = TRUE, .total_n = TRUE ) |> tbl_ard_wide_summary() Characteristic Median Q1, Q3 Age 47.0 38.0, 57.0 ard_stack( trial, ard_dichotomous(variables = response), ard_categorical(variables = grade), .missing = TRUE, .attributes = TRUE, .total_n = TRUE ) |> tbl_ard_wide_summary() Characteristic n % Tumor Response 61 31.6%Grade     I 68 34.0%    II 68 34.0%    III 64 32.0%"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":null,"dir":"Reference","previous_headings":"","what":"Butcher table — tbl_butcher","title":"Butcher table — tbl_butcher","text":"gtsummary objects can become large size becomes cumbersome working object. function removes elements gtsummary object, except required print table. may result gtsummary functions add information modify table, add_global_p(), longer execute excess elements removed (aka butchered). note, majority inline_text() calls continue execute properly.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Butcher table — tbl_butcher","text":"","code":"tbl_butcher(x, include = c(\"table_body\", \"table_styling\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Butcher table — tbl_butcher","text":"x (gtsummary) gtsummary object include (character) names additional elements retain gtsummary object. c(\"table_body\", \"table_styling\") always retained.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Butcher table — tbl_butcher","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Butcher table — tbl_butcher","text":"","code":"tbl_large <- trial |> tbl_uvregression( y = age, method = lm ) tbl_butchered <- tbl_large |> tbl_butcher() # size comparison object.size(tbl_large) |> format(units = \"Mb\") #> [1] \"7.1 Mb\" object.size(tbl_butchered)|> format(units = \"Mb\") #> [1] \"1.2 Mb\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize continuous variable — tbl_continuous","title":"Summarize continuous variable — tbl_continuous","text":"Summarize continuous variable one categorical variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize continuous variable — tbl_continuous","text":"","code":"tbl_continuous( data, variable, include = everything(), digits = NULL, by = NULL, statistic = everything() ~ \"{median} ({p25}, {p75})\", label = NULL, value = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize continuous variable — tbl_continuous","text":"data (data.frame) data frame. variable (tidy-select) single column data. Variable name continuous column summarized. include (tidy-select) Variables include summary table. Default everything(). digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. statistic (formula-list-selector) Specifies summary statistics display variable. default everything() ~ \"{median} ({p25}, {p75})\". label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. value (formula-list-selector) Supply value display variable single row, printing results variable associated value (similar 'dichotomous' display tbl_summary()).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summarize continuous variable — tbl_continuous","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize continuous variable — tbl_continuous","text":"","code":"# Example 1 ---------------------------------- tbl_continuous( data = trial, variable = age, by = trt, include = grade ) Characteristic Drug A N = 981 Drug B N = 1021 Grade     I 46 (36, 60) 48 (42, 55)    II 45 (31, 55) 51 (42, 58)    III 52 (42, 61) 45 (36, 52)1 Age: Median (Q1, Q3) # Example 2 ---------------------------------- trial |> dplyr::mutate(all_subjects = 1) |> tbl_continuous( variable = age, statistic = ~\"{mean} ({sd})\", by = trt, include = c(all_subjects, stage, grade), value = all_subjects ~ 1, label = list(all_subjects = \"All Subjects\") ) Characteristic Drug A N = 981 Drug B N = 1021 All Subjects 47 (15) 47 (14)T Stage     T1 44 (15) 50 (14)    T2 50 (13) 46 (12)    T3 49 (14) 50 (15)    T4 45 (17) 44 (15)Grade     I 46 (16) 46 (15)    II 45 (15) 50 (12)    III 51 (13) 46 (15)1 Age: Mean (SD)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross table — tbl_cross","title":"Cross table — tbl_cross","text":"function creates cross table categorical variables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross table — tbl_cross","text":"","code":"tbl_cross( data, row = 1L, col = 2L, label = NULL, statistic = ifelse(percent == \"none\", \"{n}\", \"{n} ({p}%)\"), digits = NULL, percent = c(\"none\", \"column\", \"row\", \"cell\"), margin = c(\"column\", \"row\"), missing = c(\"ifany\", \"always\", \"no\"), missing_text = \"Unknown\", margin_text = \"Total\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cross table — tbl_cross","text":"data (data.frame) data frame. row (tidy-select) Column name data used rows cross table. Default first column data. col (tidy-select) Column name data used columns cross table. Default second column data. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (string) string statistic name curly brackets replaced numeric statistic (see glue::glue). default {n}. percent argument \"column\", \"row\", \"cell\", default \"{n} ({p}%)\". digits (numeric/list/function) Specifies number decimal places round summary statistics. argument passed tbl_summary(digits = ~digits). default integers shown zero decimal places, percentages formatted style_percent(). like modify either , pass vector integers indicating number decimal places round statistics. example, statistic calculated \"{n} ({p}%)\" want percent rounded 2 decimal places use digits = c(0, 2). User may also pass styling function: digits = style_sigfig percent (string) Indicates type percentage return. Must one \"none\", \"column\", \"row\", \"cell\". Default \"cell\" {N} {p} used statistic. margin (character) Indicates margins add table. Default c(\"row\", \"column\"). Use margin = NULL suppress row column margins. missing (string) Must one c(\"ifany\", \"\", \"always\"). missing_text (string) String indicating text shown missing row. Default \"Unknown\" margin_text (string) Text display margin totals. Default \"Total\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cross table — tbl_cross","text":"tbl_cross object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Cross table — tbl_cross","text":"Karissa Whiting, Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cross table — tbl_cross","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_cross(row = trt, col = response) |> bold_labels() Tumor Response Total 0 1 Unknown Chemotherapy Treatment     Drug A 67 28 3 98    Drug B 65 33 4 102Total 132 61 7 200 # Example 2 ---------------------------------- trial |> tbl_cross(row = stage, col = trt, percent = \"cell\") |> add_p() |> bold_labels() Chemotherapy Treatment Total p-value1 Drug A Drug B T Stage 0.9    T1 28 (14%) 25 (13%) 53 (27%)     T2 25 (13%) 29 (15%) 54 (27%)     T3 22 (11%) 21 (11%) 43 (22%)     T4 23 (12%) 27 (14%) 50 (25%) Total 98 (49%) 102 (51%) 200 (100%) 1 Pearson’s Chi-squared test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"tbl_custom_summary() function calculates descriptive statistics continuous, categorical, dichotomous variables. function similar tbl_summary() allows provide custom function charge computing statistics (see Details).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"","code":"tbl_custom_summary( data, by = NULL, label = NULL, stat_fns, statistic, digits = NULL, type = NULL, value = NULL, missing = c(\"ifany\", \"no\", \"always\"), missing_text = \"Unknown\", missing_stat = \"{N_miss}\", include = everything(), overall_row = FALSE, overall_row_last = FALSE, overall_row_label = \"Overall\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"data (data.frame) data frame. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. stat_fns (formula-list-selector) Specifies function used compute statistics (see details examples). can also use dedicated helpers ratio_summary() proportion_summary(). statistic (formula-list-selector) Specifies summary statistics display variable. default list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"). See details. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"ifany\", \"\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss. include (tidy-select) Variables include summary table. Default everything(). overall_row (scalar logical) Logical indicator display overall row. Default FALSE. Use add_overall() add overall column. overall_row_last (scalar logical) Logical indicator display overall row last table. Default FALSE, display overall row first. overall_row_label (string) String indicating overall row label. Default \"Overall\".","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"tbl_custom_summary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"similarities-with-tbl-summary-","dir":"Reference","previous_headings":"","what":"Similarities with tbl_summary()","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"Please refer help file tbl_summary() regarding use select helpers, arguments include, , type, value, digits, missing missing_text.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"stat-fns-argument","dir":"Reference","previous_headings":"","what":"stat_fns argument","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"stat_fns argument specify custom function(s) used computing summary statistics. example, stat_fns = everything() ~ foo. function may take following arguments: foo(data, full_data, variable, , type, ...) data= input data frame passed tbl_custom_summary(), subset according level variable , excluding NA values current variable full_data= full input data frame passed tbl_custom_summary() variable= string indicating variable perform calculation = string indicating variable tbl_custom_summary=, present type= string indicating type variable (continuous, categorical, ...) stat_display= string indicating statistic display (statistic argument, variable) user-defined need utilize inputs. encouraged user-defined function accept ... arguments passed function, even inputs utilized user's function, e.g. foo(data, ...) (see examples). user-defined function return one row dplyr::tibble() one column per summary statistics (see examples).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"statistic-argument","dir":"Reference","previous_headings":"","what":"statistic argument","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"statistic argument specifies statistics presented table. input list formulas specify statistics report. example, statistic = list(age ~ \"{mean} ({sd})\"). statistic name appears curly brackets replaced numeric statistic (see glue::glue()). statistics indicated statistic argument returned functions defined stat_fns argument. summary type \"continuous2\", pass vector statistics. element vector result separate row summary table. categorical continuous variables, statistics number missing non-missing observations proportions also available display. {N_obs} total number observations {N_miss} number missing observations {N_nonmiss} number non-missing observations {p_miss} percentage observations missing {p_nonmiss} percentage observations missing Note categorical variables, {N_obs}, {N_miss} {N_nonmiss} refer total number, number missing number non missing observations denominator, level categorical variable. recommended use modify_footnote_header() properly describe displayed statistics (see examples).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"caution","dir":"Reference","previous_headings":"","what":"Caution","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"returned table compatible gtsummary features applicable tbl_summary object, like add_overall(), modify_footnote_header() bold_labels(). However, inappropriate case. particular, add_p() take account type displayed statistics always return p-value comparison test current variable according groups, may incorrect displayed statistics refer third variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"","code":"# Example 1 ---------------------------------- my_stats <- function(data, ...) { marker_sum <- sum(data$marker, na.rm = TRUE) mean_age <- mean(data$age, na.rm = TRUE) dplyr::tibble( marker_sum = marker_sum, mean_age = mean_age ) } my_stats(trial) #> # A tibble: 1 × 2 #> marker_sum mean_age #> #> 1 174. 47.2 trial |> tbl_custom_summary( include = c(\"stage\", \"grade\"), by = \"trt\", stat_fns = everything() ~ my_stats, statistic = everything() ~ \"A: {mean_age} - S: {marker_sum}\", digits = everything() ~ c(1, 0), overall_row = TRUE, overall_row_label = \"All stages & grades\" ) |> add_overall(last = TRUE) |> modify_footnote_header( footnote = \"A: mean age - S: sum of marker\", columns = all_stat_cols() ) |> bold_labels() Characteristic Drug A N = 981 Drug B N = 1021 Overall N = 2001 All stages & grades A: 47.0 - S: 94 A: 47.4 - S: 80 A: 47.2 - S: 174T Stage     T1 A: 44.1 - S: 19 A: 49.5 - S: 15 A: 46.8 - S: 35    T2 A: 50.2 - S: 29 A: 46.4 - S: 29 A: 48.1 - S: 59    T3 A: 48.8 - S: 21 A: 50.0 - S: 18 A: 49.4 - S: 39    T4 A: 45.3 - S: 24 A: 44.3 - S: 18 A: 44.8 - S: 42Grade     I A: 45.9 - S: 39 A: 46.4 - S: 31 A: 46.2 - S: 70    II A: 44.6 - S: 24 A: 50.3 - S: 19 A: 47.5 - S: 43    III A: 51.0 - S: 30 A: 45.7 - S: 30 A: 48.1 - S: 611 A: mean age - S: sum of marker # Example 2 ---------------------------------- # Use `data[[variable]]` to access the current variable mean_ci <- function(data, variable, ...) { test <- t.test(data[[variable]]) dplyr::tibble( mean = test$estimate, conf.low = test$conf.int[1], conf.high = test$conf.int[2] ) } trial |> tbl_custom_summary( include = c(\"marker\", \"ttdeath\"), by = \"trt\", stat_fns = ~ mean_ci, statistic = ~ \"{mean} [{conf.low}; {conf.high}]\" ) |> add_overall(last = TRUE) |> modify_footnote_header( footnote = \"mean [95% CI]\", columns = all_stat_cols() ) Characteristic Drug A N = 981 Drug B N = 1021 Overall N = 2001 Marker Level (ng/mL) 1.02 [0.83; 1.20] 0.82 [0.65; 0.99] 0.92 [0.79; 1.04]    Unknown 6 4 10Months to Death/Censor 20.2 [19.2; 21.2] 19.0 [18.0; 20.1] 19.6 [18.9; 20.4]1 mean [95% CI] # Example 3 ---------------------------------- # Use `full_data` to access the full datasets # Returned statistic can also be a character diff_to_great_mean <- function(data, full_data, ...) { mean <- mean(data$marker, na.rm = TRUE) great_mean <- mean(full_data$marker, na.rm = TRUE) diff <- mean - great_mean dplyr::tibble( mean = mean, great_mean = great_mean, diff = diff, level = ifelse(diff > 0, \"high\", \"low\") ) } trial |> tbl_custom_summary( include = c(\"grade\", \"stage\"), by = \"trt\", stat_fns = ~ diff_to_great_mean, statistic = ~ \"{mean} ({level}, diff: {diff})\", overall_row = TRUE ) |> bold_labels() Characteristic Drug A N = 981 Drug B N = 1021 Overall 1.0173 (high, diff: 0.1014) 0.8208 (low, diff: -0.0952)Grade     I 1 (high, diff: 0) 1 (high, diff: 0)    II 1 (low, diff: 0) 1 (low, diff: 0)    III 1 (high, diff: 0) 1 (high, diff: 0)T Stage     T1 1 (low, diff: 0) 1 (low, diff: 0)    T2 1 (high, diff: 0) 1 (high, diff: 0)    T3 1 (high, diff: 0) 1 (high, diff: 0)    T4 1 (high, diff: 0) 1 (low, diff: 0)1 Mean (level, diff: diff)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":null,"dir":"Reference","previous_headings":"","what":"Hierarchical Table — tbl_hierarchical","title":"Hierarchical Table — tbl_hierarchical","text":"preview function. changes coming releases, changes undergo formal deprecation cycle. Use functions generate hierarchical tables. tbl_hierarchical(): Calculates rates events (e.g. adverse events) utilizing denominator id arguments identify rows data include rate calculation. variables contains one variable last variable variables ordered factor, rates events highest level calculated. tbl_hierarchical_count(): Calculates counts events utilizing rows tabulation.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Hierarchical Table — tbl_hierarchical","text":"","code":"tbl_hierarchical( data, variables, id, denominator, by = NULL, include = everything(), statistic = everything() ~ \"{n} ({p}%)\", overall_row = FALSE, label = NULL, digits = NULL ) tbl_hierarchical_count( data, variables, denominator = NULL, by = NULL, include = everything(), overall_row = FALSE, statistic = everything() ~ \"{n}\", label = NULL, digits = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Hierarchical Table — tbl_hierarchical","text":"data (data.frame) data frame. variables (tidy-select) character vector tidy-selector columns data used create hierarchy. Hierarchy built variables order given. id (tidy-select) argument used subset data identify rows data calculate event rates tbl_hierarchical(). denominator (data.frame, integer) used define denominator enhance output. argument required tbl_hierarchical() optional tbl_hierarchical_count(). denominator argument must specified id used calculate event rates. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. include (tidy-select) variables hierarchy summary statistics returned (variable label rows) Including last element hierarchy effect since level row variable. default everything(). statistic (formula-list-selector) used specify summary statistics display variables tbl_hierarchical(). default everything() ~ \"{n} ({p})\". overall_row (scalar logical) whether overall summary row included top table. default FALSE. label (formula-list-selector) used override default labels hierarchical table, e.g. list(AESOC = \"System Organ Class\"). default variable column label attribute, attr(., 'label'). label set, column name used. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via label_style_number() statistics n N, label_style_percent(digits=1) statistic p.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Hierarchical Table — tbl_hierarchical","text":"gtsummary table class \"tbl_hierarchical\" (tbl_hierarchical()) \"tbl_hierarchical_count\" (tbl_hierarchical_count()).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"overall-row","dir":"Reference","previous_headings":"","what":"Overall Row","title":"Hierarchical Table — tbl_hierarchical","text":"overall row can added table first row specifying overall_row = TRUE. Assuming row data corresponds one event record, row count overall number events recorded used tbl_hierarchical_count(), overall number patients recorded event used tbl_hierarchical(). label overall row can specified passing '..ard_hierarchical_overall..' element label. Similarly, rounding statistics overall row can modified using digits argument, referencing '..ard_hierarchical_overall..' name.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Hierarchical Table — tbl_hierarchical","text":"","code":"ADAE_subset <- cards::ADAE |> dplyr::filter( AESOC %in% unique(cards::ADAE$AESOC)[1:5], AETERM %in% unique(cards::ADAE$AETERM)[1:5] ) # Example 1 - Event Rates -------------------- tbl_hierarchical( data = ADAE_subset, variables = c(AESOC, AETERM), by = TRTA, denominator = cards::ADSL |> mutate(TRTA = ARM), id = USUBJID, digits = everything() ~ list(p = 1), overall_row = TRUE, label = list(..ard_hierarchical_overall.. = \"Any Adverse Event\") ) Primary System Organ Class     Reported Term for the Adverse Event Placebo N = 861 Xanomeline High Dose N = 841 Xanomeline Low Dose N = 841 Any Adverse Event 26 (30.2%) 42 (50.0%) 40 (47.6%)CARDIAC DISORDERS 2 (2.3%) 3 (3.6%) 0 (0.0%)    ATRIOVENTRICULAR BLOCK SECOND DEGREE 2 (2.3%) 3 (3.6%) 0 (0.0%)GASTROINTESTINAL DISORDERS 9 (10.5%) 4 (4.8%) 5 (6.0%)    DIARRHOEA 9 (10.5%) 4 (4.8%) 5 (6.0%)GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS 8 (9.3%) 25 (29.8%) 24 (28.6%)    APPLICATION SITE ERYTHEMA 3 (3.5%) 15 (17.9%) 12 (14.3%)    APPLICATION SITE PRURITUS 6 (7.0%) 22 (26.2%) 22 (26.2%)SKIN AND SUBCUTANEOUS TISSUE DISORDERS 9 (10.5%) 14 (16.7%) 15 (17.9%)    ERYTHEMA 9 (10.5%) 14 (16.7%) 15 (17.9%)1 n (%) # Example 2 - Rates by Highest Severity ------ tbl_hierarchical( data = ADAE_subset |> mutate(AESEV = factor(AESEV, ordered = TRUE)), variables = c(AESOC, AESEV), by = TRTA, id = USUBJID, denominator = cards::ADSL |> mutate(TRTA = ARM), include = AESEV, label = list(AESEV = \"Highest Severity\") ) #> ℹ Denominator set by \"TRTA\" column in `denominator` data frame. Primary System Organ Class     Highest Severity Placebo N = 861 Xanomeline High Dose N = 841 Xanomeline Low Dose N = 841 CARDIAC DISORDERS     MILD 1 (1.2%) 1 (1.2%) 0 (0%)    MODERATE 0 (0%) 2 (2.4%) 0 (0%)    SEVERE 1 (1.2%) 0 (0%) 0 (0%)GASTROINTESTINAL DISORDERS     MILD 9 (10%) 2 (2.4%) 5 (6.0%)    MODERATE 0 (0%) 2 (2.4%) 0 (0%)    SEVERE 0 (0%) 0 (0%) 0 (0%)GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS     MILD 7 (8.1%) 12 (14%) 12 (14%)    MODERATE 1 (1.2%) 13 (15%) 10 (12%)    SEVERE 0 (0%) 0 (0%) 2 (2.4%)SKIN AND SUBCUTANEOUS TISSUE DISORDERS     MILD 5 (5.8%) 10 (12%) 7 (8.3%)    MODERATE 4 (4.7%) 4 (4.8%) 8 (9.5%)    SEVERE 0 (0%) 0 (0%) 0 (0%)1 n (%) # Example 3 - Event Counts ------------------- tbl_hierarchical_count( data = ADAE_subset, variables = c(AESOC, AETERM, AESEV), by = TRTA, overall_row = TRUE, label = list(..ard_hierarchical_overall.. = \"Total Number of AEs\") ) Primary System Organ Class     Reported Term for the Adverse Event         Severity/Intensity Placebo1 Xanomeline High Dose1 Xanomeline Low Dose1 Total Number of AEs 38 88 84CARDIAC DISORDERS 2 4 0    ATRIOVENTRICULAR BLOCK SECOND DEGREE 2 4 0        MILD 1 2 0        MODERATE 0 2 0        SEVERE 1 0 0GASTROINTESTINAL DISORDERS 10 4 7    DIARRHOEA 10 4 7        MILD 10 2 7        MODERATE 0 2 0GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS 13 58 53    APPLICATION SITE ERYTHEMA 3 23 20        MILD 3 16 9        MODERATE 0 7 8        SEVERE 0 0 3    APPLICATION SITE PRURITUS 10 35 33        MILD 8 21 21        MODERATE 2 14 11        SEVERE 0 0 1SKIN AND SUBCUTANEOUS TISSUE DISORDERS 13 22 24    ERYTHEMA 13 22 24        MILD 8 16 12        MODERATE 5 6 121 n"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":null,"dir":"Reference","previous_headings":"","what":"Likert Summary — tbl_likert","title":"Likert Summary — tbl_likert","text":"Create table ordered categorical variables wide format.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Likert Summary — tbl_likert","text":"","code":"tbl_likert( data, statistic = ~\"{n} ({p}%)\", label = NULL, digits = NULL, include = everything(), sort = c(\"ascending\", \"descending\") )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Likert Summary — tbl_likert","text":"data (data.frame) data frame. statistic (formula-list-selector) Used specify summary statistics variable. default everything() ~ \"{n} ({p}%)\". label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). include (tidy-select) Variables include summary table. Default everything(). sort (string) indicates whether levels variables placed ascending order (default) descending.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Likert Summary — tbl_likert","text":"'tbl_likert' gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Likert Summary — tbl_likert","text":"","code":"levels <- c(\"Strongly Disagree\", \"Disagree\", \"Agree\", \"Strongly Agree\") df_likert <- data.frame( recommend_friend = sample(levels, size = 20, replace = TRUE) |> factor(levels = levels), regret_purchase = sample(levels, size = 20, replace = TRUE) |> factor(levels = levels) ) # Example 1 ---------------------------------- tbl_likert_ex1 <- df_likert |> tbl_likert(include = c(recommend_friend, regret_purchase)) |> add_n() tbl_likert_ex1 Characteristic N Strongly Disagree Disagree Agree Strongly Agree recommend_friend 20 3 (15%) 5 (25%) 4 (20%) 8 (40%)regret_purchase 20 3 (15%) 6 (30%) 6 (30%) 5 (25%) # Example 2 ---------------------------------- # Add continuous summary of the likert scores list( tbl_likert_ex1, tbl_wide_summary( df_likert |> dplyr::mutate(dplyr::across(everything(), as.numeric)), statistic = c(\"{mean}\", \"{sd}\"), type = ~\"continuous\", include = c(recommend_friend, regret_purchase) ) ) |> tbl_merge(tab_spanner = FALSE) Characteristic N Strongly Disagree Disagree Agree Strongly Agree Mean SD recommend_friend 20 3 (15%) 5 (25%) 4 (20%) 8 (40%) 2.85 1.14regret_purchase 20 3 (15%) 6 (30%) 6 (30%) 5 (25%) 2.65 1.04"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":null,"dir":"Reference","previous_headings":"","what":"Merge tables — tbl_merge","title":"Merge tables — tbl_merge","text":"Merge gtsummary tables, e.g. tbl_regression, tbl_uvregression, tbl_stack, tbl_summary, tbl_svysummary, etc.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Merge tables — tbl_merge","text":"","code":"tbl_merge(tbls, tab_spanner = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Merge tables — tbl_merge","text":"tbls (list) List gtsummary objects merge tab_spanner (character) Character vector specifying spanning headers. Must length tbls. strings interpreted gt::md. Must length tbls argument. Default NULL, places default spanning header. FALSE, header placed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Merge tables — tbl_merge","text":"'tbl_merge' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Merge tables — tbl_merge","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Merge tables — tbl_merge","text":"","code":"# Example 1 ---------------------------------- # Side-by-side Regression Models library(survival) t1 <- glm(response ~ trt + grade + age, trial, family = binomial) %>% tbl_regression(exponentiate = TRUE) t2 <- coxph(Surv(ttdeath, death) ~ trt + grade + age, trial) %>% tbl_regression(exponentiate = TRUE) tbl_merge( tbls = list(t1, t2), tab_spanner = c(\"**Tumor Response**\", \"**Time to Death**\") ) Characteristic Tumor Response Time to Death OR 95% CI p-value HR 95% CI p-value Chemotherapy Treatment     Drug A — — — —     Drug B 1.13 0.60, 2.13 0.7 1.30 0.88, 1.92 0.2Grade     I — — — —     II 0.85 0.39, 1.85 0.7 1.21 0.73, 1.99 0.5    III 1.01 0.47, 2.15 >0.9 1.79 1.12, 2.86 0.014Age 1.02 1.00, 1.04 0.10 1.01 0.99, 1.02 0.3Abbreviations: CI = Confidence Interval, HR = Hazard Ratio, OR = Odds Ratio # Example 2 ---------------------------------- # Descriptive statistics alongside univariate regression, with no spanning header t3 <- trial[c(\"age\", \"grade\", \"response\")] %>% tbl_summary(missing = \"no\") %>% add_n() %>% modify_header(stat_0 ~ \"**Summary Statistics**\") t4 <- tbl_uvregression( trial[c(\"ttdeath\", \"death\", \"age\", \"grade\", \"response\")], method = coxph, y = Surv(ttdeath, death), exponentiate = TRUE, hide_n = TRUE ) tbl_merge(tbls = list(t3, t4)) %>% modify_spanning_header(everything() ~ NA_character_) Characteristic N Summary Statistics1 HR 95% CI p-value Age 189 47 (38, 57) 1.01 0.99, 1.02 0.3Grade 200     I 68 (34%) — —     II 68 (34%) 1.28 0.80, 2.05 0.3    III 64 (32%) 1.69 1.07, 2.66 0.024Tumor Response 193 61 (32%) 0.50 0.31, 0.78 0.003Abbreviations: CI = Confidence Interval, HR = Hazard Ratio 1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":null,"dir":"Reference","previous_headings":"","what":"Regression model summary — tbl_regression","title":"Regression model summary — tbl_regression","text":"function takes regression model object returns formatted table publication-ready. function customizable allowing user create bespoke regression model summary tables. Review tbl_regression() vignette detailed examples.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Regression model summary — tbl_regression","text":"","code":"tbl_regression(x, ...) # Default S3 method tbl_regression( x, label = NULL, exponentiate = FALSE, include = everything(), show_single_row = NULL, conf.level = 0.95, intercept = FALSE, estimate_fun = ifelse(exponentiate, label_style_ratio(), label_style_sigfig()), pvalue_fun = label_style_pvalue(digits = 1), tidy_fun = broom.helpers::tidy_with_broom_or_parameters, add_estimate_to_reference_rows = FALSE, conf.int = TRUE, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Regression model summary — tbl_regression","text":"x (regression model) Regression model object ... Additional arguments passed broom.helpers::tidy_plus_plus(). label (formula-list-selector) Used change variables labels, e.g. list(age = \"Age\", stage = \"Path T Stage\") exponentiate (scalar logical) Logical indicating whether exponentiate coefficient estimates. Default FALSE. include (tidy-select) Variables include output. Default everything(). show_single_row (tidy-select) default categorical variables printed multiple rows. variable dichotomous (e.g. Yes/) wish print regression coefficient single row, include variable name(s) . conf.level (scalar real) Confidence level confidence interval/credible interval. Defaults 0.95. intercept (scalar logical) Indicates whether include intercept output. Default FALSE estimate_fun (function) Function round format coefficient estimates. Default label_style_sigfig() coefficients transformed, label_style_ratio() coefficients exponentiated. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). tidy_fun (function) Tidier function model. Default use broom::tidy(). error occurs, tidying model attempted parameters::model_parameters(), installed. add_estimate_to_reference_rows (scalar logical) Add reference value. Default FALSE. conf.int (scalar logical) Logical indicating whether include confidence interval output. Default TRUE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Regression model summary — tbl_regression","text":"tbl_regression object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Regression model summary — tbl_regression","text":"default method tbl_regression() model summary uses broom::tidy(x) perform initial tidying model object. , however, models use modifications. \"parsnip/workflows\": model prepared using parsnip/workflows, original model fit extracted original x= argument replaced model fit. typically go unnoticed; however,provided custom tidier tidy_fun= tidier applied model fit object parsnip/workflows object. \"survreg\": scale parameter removed, broom::tidy(x) %>% dplyr::filter(term != \"Log(scale)\") \"multinom\": multinomial outcome complex, one line per covariate per outcome (less reference group) \"gam\": Uses internal tidier tidy_gam() print parametric smooth terms. \"lmerMod\", \"glmerMod\", \"glmmTMB\", \"glmmadmb\", \"stanreg\", \"brmsfit\": mixed effects models use broom.mixed::tidy(x, effects = \"fixed\"). Specify tidy_fun = broom.mixed::tidy print random components.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Regression model summary — tbl_regression","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Regression model summary — tbl_regression","text":"","code":"# Example 1 ---------------------------------- glm(response ~ age + grade, trial, family = binomial()) |> tbl_regression(exponentiate = TRUE) Characteristic OR 95% CI p-value Age 1.02 1.00, 1.04 0.10Grade     I — —     II 0.85 0.39, 1.85 0.7    III 1.01 0.47, 2.16 >0.9Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression_methods.html","id":null,"dir":"Reference","previous_headings":"","what":"Methods for tbl_regression — tbl_regression_methods","title":"Methods for tbl_regression — tbl_regression_methods","text":"regression models handled tbl_regression(), uses broom::tidy() perform initial tidying results. , however, model types modified default printing behavior. methods listed .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression_methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Methods for tbl_regression — tbl_regression_methods","text":"","code":"# S3 method for class 'model_fit' tbl_regression(x, ...) # S3 method for class 'workflow' tbl_regression(x, ...) # S3 method for class 'survreg' tbl_regression( x, tidy_fun = function(x, ...) dplyr::filter(broom::tidy(x, ...), .data$term != \"Log(scale)\"), ... ) # S3 method for class 'mira' tbl_regression(x, tidy_fun = pool_and_tidy_mice, ...) # S3 method for class 'mipo' tbl_regression(x, ...) # S3 method for class 'lmerMod' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'glmerMod' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'glmmTMB' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'glmmadmb' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'stanreg' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'brmsfit' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'gam' tbl_regression(x, tidy_fun = tidy_gam, ...) # S3 method for class 'crr' tbl_regression(x, ...) # S3 method for class 'multinom' tbl_regression(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression_methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Methods for tbl_regression — tbl_regression_methods","text":"x (regression model) Regression model object ... arguments passed tbl_regression() tidy_fun (function) Tidier function model. Default use broom::tidy(). error occurs, tidying model attempted parameters::model_parameters(), installed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression_methods.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Methods for tbl_regression — tbl_regression_methods","text":"default method tbl_regression() model summary uses broom::tidy(x) perform initial tidying model object. , however, models use modifications. \"parsnip/workflows\": model prepared using parsnip/workflows, original model fit extracted original x= argument replaced model fit. typically go unnoticed; however,provided custom tidier tidy_fun= tidier applied model fit object parsnip/workflows object. \"survreg\": scale parameter removed, broom::tidy(x) %>% dplyr::filter(term != \"Log(scale)\") \"multinom\": multinomial outcome complex, one line per covariate per outcome (less reference group) \"gam\": Uses internal tidier tidy_gam() print parametric smooth terms. \"lmerMod\", \"glmerMod\", \"glmmTMB\", \"glmmadmb\", \"stanreg\", \"brmsfit\": mixed effects models use broom.mixed::tidy(x, effects = \"fixed\"). Specify tidy_fun = broom.mixed::tidy print random components.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":null,"dir":"Reference","previous_headings":"","what":"Split gtsummary table — tbl_split","title":"Split gtsummary table — tbl_split","text":"tbl_split function splits single gtsummary table multiple tables. Updates print method expected.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Split gtsummary table — tbl_split","text":"","code":"tbl_split(x, ...) # S3 method for class 'gtsummary' tbl_split(x, variables, ...) # S3 method for class 'tbl_split' print(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Split gtsummary table — tbl_split","text":"x (gtsummary) gtsummary table ... dots future extensions must empty. variables (tidy-select) variables split gtsummary table rows (tables separated variables)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Split gtsummary table — tbl_split","text":"tbl_split object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Split gtsummary table — tbl_split","text":"","code":"tbl <- tbl_summary(trial) |> tbl_split(variables = c(marker, grade))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":null,"dir":"Reference","previous_headings":"","what":"Stack tables — tbl_stack","title":"Stack tables — tbl_stack","text":"Assists patching together complex tables. tbl_stack() appends two gtsummary tables. Column attributes, including number formatting column footnotes, retained first passed gtsummary object.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Stack tables — tbl_stack","text":"","code":"tbl_stack(tbls, group_header = NULL, quiet = FALSE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Stack tables — tbl_stack","text":"tbls (list) List gtsummary objects group_header (character) Character vector table headers length matches length tbls quiet (scalar logical) Logical indicating whether suppress additional messaging. Default FALSE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Stack tables — tbl_stack","text":"tbl_stack object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Stack tables — tbl_stack","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Stack tables — tbl_stack","text":"","code":"# Example 1 ---------------------------------- # stacking two tbl_regression objects t1 <- glm(response ~ trt, trial, family = binomial) %>% tbl_regression( exponentiate = TRUE, label = list(trt ~ \"Treatment (unadjusted)\") ) t2 <- glm(response ~ trt + grade + stage + marker, trial, family = binomial) %>% tbl_regression( include = \"trt\", exponentiate = TRUE, label = list(trt ~ \"Treatment (adjusted)\") ) tbl_stack(list(t1, t2)) Characteristic OR 95% CI p-value Treatment (unadjusted)     Drug A — —     Drug B 1.21 0.66, 2.24 0.5Treatment (adjusted)     Drug A — —     Drug B 1.48 0.78, 2.86 0.2Abbreviations: CI = Confidence Interval, OR = Odds Ratio # Example 2 ---------------------------------- # stacking two tbl_merge objects library(survival) t3 <- coxph(Surv(ttdeath, death) ~ trt, trial) %>% tbl_regression( exponentiate = TRUE, label = list(trt ~ \"Treatment (unadjusted)\") ) t4 <- coxph(Surv(ttdeath, death) ~ trt + grade + stage + marker, trial) %>% tbl_regression( include = \"trt\", exponentiate = TRUE, label = list(trt ~ \"Treatment (adjusted)\") ) # first merging, then stacking row1 <- tbl_merge(list(t1, t3), tab_spanner = c(\"Tumor Response\", \"Death\")) row2 <- tbl_merge(list(t2, t4)) tbl_stack(list(row1, row2), group_header = c(\"Unadjusted Analysis\", \"Adjusted Analysis\")) #> Column headers among stacked tables differ. Headers from the first table are #> used. #> ℹ Use `quiet = TRUE` to suppress this message. Characteristic Tumor Response Death OR 95% CI p-value HR 95% CI p-value Unadjusted Analysis Treatment (unadjusted)     Drug A — — — —     Drug B 1.21 0.66, 2.24 0.5 1.25 0.86, 1.81 0.2Adjusted Analysis Treatment (adjusted)     Drug A — — — —     Drug B 1.48 0.78, 2.86 0.2 1.30 0.88, 1.92 0.2Abbreviations: CI = Confidence Interval, HR = Hazard Ratio, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":null,"dir":"Reference","previous_headings":"","what":"Stratified gtsummary tables — tbl_strata","title":"Stratified gtsummary tables — tbl_strata","text":"Build stratified gtsummary table. gtsummary table accepts data frame first argument can stratified. tbl_strata(), stratified subset data frame passed function .tbl_fun=, e.g. purrr::map(data, .tbl_fun). tbl_strata2(), stratified data frame strata level passed .tbl_fun=, e.g. purrr::map2(data, strata, .tbl_fun)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Stratified gtsummary tables — tbl_strata","text":"","code":"tbl_strata( data, strata, .tbl_fun, ..., .sep = \", \", .combine_with = c(\"tbl_merge\", \"tbl_stack\"), .combine_args = NULL, .header = ifelse(.combine_with == \"tbl_merge\", \"**{strata}**\", \"{strata}\"), .stack_group_header = NULL, .quiet = NULL ) tbl_strata2( data, strata, .tbl_fun, ..., .sep = \", \", .combine_with = c(\"tbl_merge\", \"tbl_stack\"), .combine_args = NULL, .header = ifelse(.combine_with == \"tbl_merge\", \"**{strata}**\", \"{strata}\"), .stack_group_header = NULL, .quiet = TRUE )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Stratified gtsummary tables — tbl_strata","text":"data (data.frame, survey.design) data frame survey object strata (tidy-select) character vector tidy-selector columns data stratify results .tbl_fun (function) function formula. function, used . formula, e.g. ~ .x %>% tbl_summary() %>% add_p(), converted function. stratified data frame passed function. ... Additional arguments passed .tbl_fun function. .sep (string) one stratifying variable passed, string used separate levels spanning header. Default \", \" .combine_with (string) One c(\"tbl_merge\", \"tbl_stack\"). Names function used combine stratified tables. .combine_args (named list) named list arguments passed function specified .combine_with .header (string) String indicating headers placed. Default \"**{strata}**\" .combine_with = \"tbl_merge\" \"{strata}\" .combine_with = \"tbl_stack\". Items placed curly brackets evaluated according glue::glue() syntax. - strata stratum levels - n N within stratum - N Overall N evaluated value .header also available within tbl_strata2(.tbl_fun) .stack_group_header .quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"tips","dir":"Reference","previous_headings":"","what":"Tips","title":"Stratified gtsummary tables — tbl_strata","text":"tbl_summary() number digits continuous variables rounded determined separately within stratum data frame. Set digits= argument ensure continuous variables rounded number decimal places. levels categorical variable unobserved within stratum, convert variable factor ensure levels appear stratum's summary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Stratified gtsummary tables — tbl_strata","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Stratified gtsummary tables — tbl_strata","text":"Response Rate Grade","code":"# Example 1 ---------------------------------- trial |> select(age, grade, stage, trt) |> mutate(grade = paste(\"Grade\", grade)) |> tbl_strata( strata = grade, .tbl_fun = ~ .x |> tbl_summary(by = trt, missing = \"no\") |> add_n(), .header = \"**{strata}**, N = {n}\" ) Characteristic Grade I, N = 68 Grade II, N = 68 Grade III, N = 64 N Drug A N = 351 Drug B N = 331 N Drug A N = 321 Drug B N = 361 N Drug A N = 311 Drug B N = 331 Age 66 46 (36, 60) 48 (42, 55) 62 45 (31, 55) 51 (42, 58) 61 52 (42, 61) 45 (36, 52)T Stage 68 68 64     T1 8 (23%) 9 (27%) 14 (44%) 9 (25%) 6 (19%) 7 (21%)    T2 8 (23%) 10 (30%) 8 (25%) 9 (25%) 9 (29%) 10 (30%)    T3 11 (31%) 7 (21%) 5 (16%) 6 (17%) 6 (19%) 8 (24%)    T4 8 (23%) 7 (21%) 5 (16%) 12 (33%) 10 (32%) 8 (24%)1 Median (Q1, Q3); n (%) # Example 2 ---------------------------------- trial |> select(grade, response) |> mutate(grade = paste(\"Grade\", grade)) |> tbl_strata2( strata = grade, .tbl_fun = ~ .x %>% tbl_summary( label = list(response = .y), missing = \"no\", statistic = response ~ \"{p}%\" ) |> add_ci(pattern = \"{stat} ({ci})\") |> modify_header(stat_0 = \"**Rate (95% CI)**\") |> remove_footnote_header(stat_0), .combine_with = \"tbl_stack\", .combine_args = list(group_header = NULL) ) |> modify_caption(\"**Response Rate by Grade**\") Response Rate by Grade Characteristic Rate (95% CI) Grade I 31% (21%, 44%)Grade II 30% (20%, 43%)Grade III 33% (22%, 46%)Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary table — tbl_summary","title":"Summary table — tbl_summary","text":"tbl_summary() function calculates descriptive statistics continuous, categorical, dichotomous variables. Review tbl_summary vignette detailed examples.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary table — tbl_summary","text":"","code":"tbl_summary( data, by = NULL, label = NULL, statistic = list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"), digits = NULL, type = NULL, value = NULL, missing = c(\"ifany\", \"no\", \"always\"), missing_text = \"Unknown\", missing_stat = \"{N_miss}\", sort = all_categorical(FALSE) ~ \"alphanumeric\", percent = c(\"column\", \"row\", \"cell\"), include = everything() )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary table — tbl_summary","text":"data (data.frame) data frame. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (formula-list-selector) Specifies summary statistics display variable. default list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"). See details. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"ifany\", \"\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss. sort (formula-list-selector) Specifies sorting perform categorical variables. Values must one c(\"alphanumeric\", \"frequency\"). Default all_categorical(FALSE) ~ \"alphanumeric\". percent (string) Indicates type percentage return. Must one c(\"column\", \"row\", \"cell\"). Default \"column\". include (tidy-select) Variables include summary table. Default everything().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary table — tbl_summary","text":"gtsummary table class \"tbl_summary\" table class c('tbl_summary', 'gtsummary')","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"statistic-argument","dir":"Reference","previous_headings":"","what":"statistic argument","title":"Summary table — tbl_summary","text":"statistic argument specifies statistics presented table. input dictates summary statistics presented table. example, statistic = list(age ~ \"{mean} ({sd})\") report mean standard deviation age; statistic = list(all_continuous() ~ \"{mean} ({sd})\") report mean standard deviation continuous variables. values interpreted using glue::glue() syntax: name appears curly brackets interpreted function name formatted result function placed table. categorical variables, following statistics available display: {n} (frequency), {N} (denominator), {p} (percent). continuous variables, univariate function may used. commonly used functions {median}, {mean}, {sd}, {min}, {max}. Additionally, {p##} available percentiles, ## integer 0 100. example, p25: quantile(probs=0.25, type=2). summary type \"continuous2\", pass vector statistics. element vector result separate row summary table. categorical continuous variables, statistics number missing non-missing observations proportions available display. {N_obs} total number observations {N_miss} number missing observations {N_nonmiss} number non-missing observations {p_miss} percentage observations missing {p_nonmiss} percentage observations missing","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"digits-argument","dir":"Reference","previous_headings":"","what":"digits argument","title":"Summary table — tbl_summary","text":"digits argument specifies number digits (formatting function) statistics rounded . values passed can either single integer, vector integers, function, list functions. single integer function passed, recycled length number statistics presented. example, statistic \"{mean} ({sd})\", equivalent pass 1, c(1, 1), label_style_number(digits=1), list(label_style_number(digits=1), label_style_number(digits=1)). Named lists also accepted change default formatting single statistic, e.g. list(sd = label_style_number(digits=1)).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"type-and-value-arguments","dir":"Reference","previous_headings":"","what":"type and value arguments","title":"Summary table — tbl_summary","text":"four summary types. Use type argument change default summary types. \"continuous\" summaries shown single row. numeric variables default summary type continuous. \"continuous2\" summaries shown 2 rows \"categorical\" multi-line summaries nominal data. Character variables, factor variables, numeric variables fewer 10 unique levels default type categorical. change numeric variable continuous defaulted categorical, use type = list(varname ~ \"continuous\") \"dichotomous\" categorical variables displayed single row, rather one row per level variable. Variables coded TRUE/FALSE, 0/1, yes/assumed dichotomous, TRUE, 1, yes rows displayed. Otherwise, value display must specified value argument, e.g. value = list(varname ~ \"level show\")","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summary table — tbl_summary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary table — tbl_summary","text":"","code":"# Example 1 ---------------------------------- trial |> select(age, grade, response) |> tbl_summary() Characteristic N = 2001 Age 47 (38, 57)    Unknown 11Grade     I 68 (34%)    II 68 (34%)    III 64 (32%)Tumor Response 61 (32%)    Unknown 71 Median (Q1, Q3); n (%) # Example 2 ---------------------------------- trial |> select(age, grade, response, trt) |> tbl_summary( by = trt, label = list(age = \"Patient Age\"), statistic = list(all_continuous() ~ \"{mean} ({sd})\"), digits = list(age = c(0, 1)) ) Characteristic Drug A N = 981 Drug B N = 1021 Patient Age 47 (14.7) 47 (14.0)    Unknown 7 4Grade     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)Tumor Response 28 (29%) 33 (34%)    Unknown 3 41 Mean (SD); n (%) # Example 3 ---------------------------------- trial |> select(age, marker) |> tbl_summary( type = all_continuous() ~ \"continuous2\", statistic = all_continuous() ~ c(\"{median} ({p25}, {p75})\", \"{min}, {max}\"), missing = \"no\" ) Characteristic N = 200 Age     Median (Q1, Q3) 47 (38, 57)    Min, Max 6, 83Marker Level (ng/mL)     Median (Q1, Q3) 0.64 (0.22, 1.41)    Min, Max 0.00, 3.87"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Survival table — tbl_survfit","title":"Survival table — tbl_survfit","text":"Function takes survfit object argument, provides formatted summary table results","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Survival table — tbl_survfit","text":"","code":"tbl_survfit(x, ...) # S3 method for class 'survfit' tbl_survfit(x, ...) # S3 method for class 'data.frame' tbl_survfit(x, y, include = everything(), conf.level = 0.95, ...) # S3 method for class 'list' tbl_survfit( x, times = NULL, probs = NULL, statistic = \"{estimate} ({conf.low}, {conf.high})\", label = NULL, label_header = ifelse(!is.null(times), \"**Time {time}**\", \"**{style_sigfig(prob, scale=100)}% Percentile**\"), estimate_fun = ifelse(!is.null(times), label_style_percent(suffix = \"%\"), label_style_sigfig()), missing = \"--\", type = NULL, reverse = FALSE, quiet = TRUE, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Survival table — tbl_survfit","text":"x (survfit, list, data.frame) survfit object, list survfit objects, data frame. data frame passed, list survfit objects constructed using variable stratifying variable. ... tbl_survfit.data.frame() tbl_survfit.survfit() arguments passed tbl_survfit.list(). used tbl_survfit.list() called directly. y outcome call, e.g. y = Surv(ttdeath, death) include Variable include stratifying variables. conf.level (scalar numeric) ] Confidence level confidence intervals. Default 0.95 times (numeric) vector times return survival probabilities. probs (numeric) vector probabilities values (0,1) specifying survival quantiles return. statistic (string) string defining statistics present table. Default \"{estimate} ({conf.low}, {conf.high})\" label (formula-list-selector) List formulas specifying variables labels, e.g. list(age = \"Age, yrs\", stage = \"Path T Stage\"), string single variable table. label_header (string) string specifying column labels statistics. Default \"{prob} Percentile\" survival percentiles, \"Time {time}\" n-year survival estimates estimate_fun (function) function format Kaplan-Meier estimates. Default label_style_percent() survival probabilities label_style_sigfig() survival times missing (string) text fill estimate estimable. Default \"--\" type (string NULL) type statistic report. Available Kaplan-Meier time estimates , otherwise type ignored. Default NULL. Must one following: reverse quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Survival table — tbl_survfit","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Survival table — tbl_survfit","text":"","code":"library(survival) # Example 1 ---------------------------------- # Pass single survfit() object tbl_survfit( survfit(Surv(ttdeath, death) ~ trt, trial), times = c(12, 24), label_header = \"**{time} Month**\" ) Characteristic 12 Month 24 Month Chemotherapy Treatment     Drug A 91% (85%, 97%) 47% (38%, 58%)    Drug B 86% (80%, 93%) 41% (33%, 52%) # Example 2 ---------------------------------- # Pass a data frame tbl_survfit( trial, y = \"Surv(ttdeath, death)\", include = c(trt, grade), probs = 0.5, label_header = \"**Median Survival**\" ) Characteristic Median Survival Chemotherapy Treatment     Drug A 24 (21, —)    Drug B 21 (18, —)Grade     I — (22, —)    II 22 (18, —)    III 20 (18, 23) # Example 3 ---------------------------------- # Pass a list of survfit() objects list(survfit(Surv(ttdeath, death) ~ 1, trial), survfit(Surv(ttdeath, death) ~ trt, trial)) |> tbl_survfit(times = c(12, 24)) Characteristic Time 12 Time 24 Overall 89% (84%, 93%) 44% (38%, 51%)Chemotherapy Treatment     Drug A 91% (85%, 97%) 47% (38%, 58%)    Drug B 86% (80%, 93%) 41% (33%, 52%) # Example 4 Competing Events Example --------- # adding a competing event for death (cancer vs other causes) set.seed(1123) library(dplyr, warn.conflicts = FALSE, quietly = TRUE) trial2 <- trial |> dplyr::mutate( death_cr = dplyr::case_when( death == 0 ~ \"censor\", runif(n()) < 0.5 ~ \"death from cancer\", TRUE ~ \"death other causes\" ) |> factor() ) survfit(Surv(ttdeath, death_cr) ~ grade, data = trial2) |> tbl_survfit(times = c(12, 24), label = \"Tumor Grade\") #> Multi-state model detected. Showing probabilities into state 'death from #> cancer'. Characteristic Time 12 Time 24 Tumor Grade     I 2.9% (0.8%, 12%) 26% (18%, 39%)    II 8.8% (4.1%, 19%) 25% (17%, 38%)    III 6.3% (2.4%, 16%) 34% (25%, 48%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit_errors.html","id":null,"dir":"Reference","previous_headings":"","what":"Common Sources of Error with tbl_survfit() — tbl_survfit_errors","title":"Common Sources of Error with tbl_survfit() — tbl_survfit_errors","text":"functions add_n() add_p() run tbl_survfit(), original call survival::survfit() extracted formula= data= arguments used calculate N p-value. values formula= data= unavailable, functions execute. tips modify code ensure functions run without issue. Let tbl_survfit() construct survival::survfit() passing data frame tbl_survfit(). survfit model constructed manner ensuring formula data available. works stratified model. Instead following line Use code Construct expression survival::survfit() evaluating . Ensure formula data available call using tidyverse bang-bang operator, !!. Use code","code":"survfit(Surv(ttdeath, death) ~ trt, trial) %>% tbl_survfit(times = c(12, 24)) trial %>% select(ttdeath, death, trt) %>% tbl_survfit(y = Surv(ttdeath, death), times = c(12, 24)) formula_arg <- Surv(ttdeath, death) ~ 1 data_arg <- trial rlang::expr(survfit(!!formula_arg, !!data_arg)) %>% eval() %>% tbl_survfit(times = c(12, 24))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a table of summary statistics from a survey object — tbl_svysummary","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"tbl_svysummary() function calculates descriptive statistics continuous, categorical, dichotomous variables taking account survey weights design.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"","code":"tbl_svysummary( data, by = NULL, label = NULL, statistic = list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"), digits = NULL, type = NULL, value = NULL, missing = c(\"ifany\", \"no\", \"always\"), missing_text = \"Unknown\", missing_stat = \"{N_miss}\", sort = all_categorical(FALSE) ~ \"alphanumeric\", percent = c(\"column\", \"row\", \"cell\"), include = everything() )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"data (survey.design) survey object created created survey::svydesign() (tidy-select) single column data. Summary statistics stratified variable. Default NULL. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (formula-list-selector) Specifies summary statistics display variable. default list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"). See details. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"ifany\", \"\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss. sort (formula-list-selector) Specifies sorting perform categorical variables. Values must one c(\"alphanumeric\", \"frequency\"). Default all_categorical(FALSE) ~ \"alphanumeric\". percent (string) Indicates type percentage return. Must one c(\"column\", \"row\", \"cell\"). Default \"column\". include (tidy-select) Variables include summary table. Default everything().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"'tbl_svysummary' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"statistic-argument","dir":"Reference","previous_headings":"","what":"statistic argument","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"statistic argument specifies statistics presented table. input list formulas specify statistics report. example, statistic = list(age ~ \"{mean} ({sd})\") report mean standard deviation age; statistic = list(all_continuous() ~ \"{mean} ({sd})\") report mean standard deviation continuous variables. statistic name appears curly brackets replaced numeric statistic (see glue::glue()). categorical variables following statistics available display. {n} frequency {N} denominator, cohort size {p} proportion {p.std.error} standard error sample proportion (0 1 scale) computed survey::svymean() {deff} design effect sample proportion computed survey::svymean() {n_unweighted} unweighted frequency {N_unweighted} unweighted denominator {p_unweighted} unweighted formatted percentage continuous variables following statistics available display. {median} median {mean} mean {mean.std.error} standard error sample mean computed survey::svymean() {deff} design effect sample mean computed survey::svymean() {sd} standard deviation {var} variance {min} minimum {max} maximum {p##} integer percentile, ## integer 0 100 {sum} sum Unlike tbl_summary(), possible pass custom function. categorical continuous variables, statistics number missing non-missing observations proportions available display. {N_obs} total number observations {N_miss} number missing observations {N_nonmiss} number non-missing observations {p_miss} percentage observations missing {p_nonmiss} percentage observations missing {N_obs_unweighted} unweighted total number observations {N_miss_unweighted} unweighted number missing observations {N_nonmiss_unweighted} unweighted number non-missing observations {p_miss_unweighted} unweighted percentage observations missing {p_nonmiss_unweighted} unweighted percentage observations missing Note categorical variables, {N_obs}, {N_miss} {N_nonmiss} refer total number, number missing number non missing observations denominator, level categorical variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"type-and-value-arguments","dir":"Reference","previous_headings":"","what":"type and value arguments","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"four summary types. Use type argument change default summary types. \"continuous\" summaries shown single row. numeric variables default summary type continuous. \"continuous2\" summaries shown 2 rows \"categorical\" multi-line summaries nominal data. Character variables, factor variables, numeric variables fewer 10 unique levels default type categorical. change numeric variable continuous defaulted categorical, use type = list(varname ~ \"continuous\") \"dichotomous\" categorical variables displayed single row, rather one row per level variable. Variables coded TRUE/FALSE, 0/1, yes/assumed dichotomous, TRUE, 1, yes rows displayed. Otherwise, value display must specified value argument, e.g. value = list(varname ~ \"level show\")","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"","code":"# Example 1 ---------------------------------- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) |> tbl_svysummary(by = Survived, percent = \"row\", include = c(Class, Age)) Characteristic No N = 1,4901 Yes N = 7111 Class     1st 122 (38%) 203 (62%)    2nd 167 (59%) 118 (41%)    3rd 528 (75%) 178 (25%)    Crew 673 (76%) 212 (24%)Age     Child 52 (48%) 57 (52%)    Adult 1,438 (69%) 654 (31%)1 n (%) # Example 2 ---------------------------------- # A dataset with a complex design data(api, package = \"survey\") survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) |> tbl_svysummary(by = \"both\", include = c(api00, stype)) |> modify_spanning_header(all_stat_cols() ~ \"**Survived**\") Characteristic Survived No N = 1,6921 Yes N = 4,5021 api00 631 (559, 710) 655 (551, 723)stype     E 1,083 (64%) 3,791 (84%)    H 237 (14%) 237 (5.3%)    M 372 (22%) 474 (11%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":null,"dir":"Reference","previous_headings":"","what":"Univariable regression model summary — tbl_uvregression","title":"Univariable regression model summary — tbl_uvregression","text":"function estimates univariable regression models returns publication-ready table. can create regression models holding either covariate outcome constant.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Univariable regression model summary — tbl_uvregression","text":"","code":"tbl_uvregression(data, ...) # S3 method for class 'data.frame' tbl_uvregression( data, y = NULL, x = NULL, method, method.args = list(), exponentiate = FALSE, label = NULL, include = everything(), tidy_fun = broom.helpers::tidy_with_broom_or_parameters, hide_n = FALSE, show_single_row = NULL, conf.level = 0.95, estimate_fun = ifelse(exponentiate, label_style_ratio(), label_style_sigfig()), pvalue_fun = label_style_pvalue(digits = 1), formula = \"{y} ~ {x}\", add_estimate_to_reference_rows = FALSE, conf.int = TRUE, ... ) # S3 method for class 'survey.design' tbl_uvregression( data, y = NULL, x = NULL, method, method.args = list(), exponentiate = FALSE, label = NULL, include = everything(), tidy_fun = broom.helpers::tidy_with_broom_or_parameters, hide_n = FALSE, show_single_row = NULL, conf.level = 0.95, estimate_fun = ifelse(exponentiate, label_style_ratio(), label_style_sigfig()), pvalue_fun = label_style_pvalue(digits = 1), formula = \"{y} ~ {x}\", add_estimate_to_reference_rows = FALSE, conf.int = TRUE, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Univariable regression model summary — tbl_uvregression","text":"data (data.frame, survey.design) data frame survey design object. ... Additional arguments passed broom.helpers::tidy_plus_plus(). y, x (expression, string) Model outcome (e.g. y=recurrence y=Surv(time, recur)) covariate (e.g. x=trt. column specified include regressed constant y x. Specify one one y x. method (string/function) Regression method function, e.g. lm, glm, survival::coxph, survey::svyglm, etc. Methods may passed functions (method=lm) strings (method='lm'). method.args (named list) Named list arguments passed method. exponentiate (scalar logical) Logical indicating whether exponentiate coefficient estimates. Default FALSE. label (formula-list-selector) Used change variables labels, e.g. list(age = \"Age\", stage = \"Path T Stage\") include (tidy-select) Variables include output. Default everything(). tidy_fun (function) Tidier function model. Default use broom::tidy(). error occurs, tidying model attempted parameters::model_parameters(), installed. hide_n (scalar logical) Hide N column. Default FALSE show_single_row (tidy-select) default categorical variables printed multiple rows. variable dichotomous (e.g. Yes/) wish print regression coefficient single row, include variable name(s) . conf.level (scalar real) Confidence level confidence interval/credible interval. Defaults 0.95. estimate_fun (function) Function round format coefficient estimates. Default label_style_sigfig() coefficients transformed, label_style_ratio() coefficients exponentiated. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). formula (string) String model formula. Uses glue::glue() syntax. Default \"{y} ~ {x}\", {y} dependent variable, {x} represents single covariate. random intercept model, formula may formula = \"{y} ~ {x} + (1 | gear)\". add_estimate_to_reference_rows (scalar logical) Add reference value. Default FALSE. conf.int (scalar logical) Logical indicating whether include confidence interval output. Default TRUE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Univariable regression model summary — tbl_uvregression","text":"tbl_uvregression object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"x-and-y-arguments","dir":"Reference","previous_headings":"","what":"x and y arguments","title":"Univariable regression model summary — tbl_uvregression","text":"models holding outcome constant, function takes arguments data frame, type regression model, outcome variable y=. column data frame regressed specified outcome. tbl_uvregression() function arguments similar tbl_regression() arguments. Review tbl_uvregression vignette detailed examples. may alternatively hold single covariate constant. , pass data frame, type regression model, single covariate x= argument. column data frame serve outcome univariate regression model. Take care using x argument columns data frame appropriate type model, e.g. continuous variables appropriate lm, dichotomous variables appropriate logistic regression glm.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Univariable regression model summary — tbl_uvregression","text":"default method tbl_regression() model summary uses broom::tidy(x) perform initial tidying model object. , however, models use modifications. \"parsnip/workflows\": model prepared using parsnip/workflows, original model fit extracted original x= argument replaced model fit. typically go unnoticed; however,provided custom tidier tidy_fun= tidier applied model fit object parsnip/workflows object. \"survreg\": scale parameter removed, broom::tidy(x) %>% dplyr::filter(term != \"Log(scale)\") \"multinom\": multinomial outcome complex, one line per covariate per outcome (less reference group) \"gam\": Uses internal tidier tidy_gam() print parametric smooth terms. \"lmerMod\", \"glmerMod\", \"glmmTMB\", \"glmmadmb\", \"stanreg\", \"brmsfit\": mixed effects models use broom.mixed::tidy(x, effects = \"fixed\"). Specify tidy_fun = broom.mixed::tidy print random components.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Univariable regression model summary — tbl_uvregression","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Univariable regression model summary — tbl_uvregression","text":"","code":"# Example 1 ---------------------------------- tbl_uvregression( trial, method = glm, y = response, method.args = list(family = binomial), exponentiate = TRUE, include = c(\"age\", \"grade\") ) Characteristic N OR 95% CI p-value Age 183 1.02 1.00, 1.04 0.10Grade 193     I — —     II 0.95 0.45, 2.00 0.9    III 1.10 0.52, 2.29 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio # Example 2 ---------------------------------- # rounding pvalues to 2 decimal places library(survival) tbl_uvregression( trial, method = coxph, y = Surv(ttdeath, death), exponentiate = TRUE, include = c(\"age\", \"grade\", \"response\"), pvalue_fun = label_style_pvalue(digits = 2) ) Characteristic N HR 95% CI p-value Age 189 1.01 0.99, 1.02 0.33Grade 200     I — —     II 1.28 0.80, 2.05 0.31    III 1.69 1.07, 2.66 0.024Tumor Response 193 0.50 0.31, 0.78 0.003Abbreviations: CI = Confidence Interval, HR = Hazard Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide summary table — tbl_wide_summary","title":"Wide summary table — tbl_wide_summary","text":"function similar tbl_summary(), places summary statistics wide, separate columns. included variables must summary type, e.g. continuous summaries categorical summaries (encompasses dichotomous variables).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide summary table — tbl_wide_summary","text":"","code":"tbl_wide_summary( data, label = NULL, statistic = switch(type[[1]], continuous = c(\"{median}\", \"{p25}, {p75}\"), c(\"{n}\", \"{p}%\")), digits = NULL, type = NULL, value = NULL, sort = all_categorical(FALSE) ~ \"alphanumeric\", include = everything() )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wide summary table — tbl_wide_summary","text":"data (data.frame) data frame. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (character) character vector statistics present. element vector result column summary table. Default c(\"{median}\", \"{p25}, {p75}\") continuous summaries, c(\"{n}\", \"{p}%\") categorical/dichotomous summaries digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. sort (formula-list-selector) Specifies sorting perform categorical variables. Values must one c(\"alphanumeric\", \"frequency\"). Default all_categorical(FALSE) ~ \"alphanumeric\". include (tidy-select) Variables include summary table. Default everything().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wide summary table — tbl_wide_summary","text":"gtsummary table class 'tbl_wide_summary'","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Wide summary table — tbl_wide_summary","text":"","code":"trial |> tbl_wide_summary(include = c(response, grade)) Characteristic n % Tumor Response 61 32%Grade     I 68 34%    II 68 34%    III 64 32% trial |> tbl_strata( strata = trt, ~tbl_wide_summary(.x, include = c(age, marker)) ) Characteristic Drug A Drug B Median Q1, Q3 Median Q1, Q3 Age 46 37, 60 48 39, 56Marker Level (ng/mL) 0.84 0.23, 1.60 0.52 0.18, 1.21"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tests.html","id":null,"dir":"Reference","previous_headings":"","what":"Tests/methods available in add_p() and add_difference() — tests","title":"Tests/methods available in add_p() and add_difference() — tests","text":"listing tests available internally within gtsummary. Tests listed ... may additional arguments passed using add_p(test.args=). example, calculate p-value t.test() assuming equal variance, use tbl_summary(trial, = trt) %>% add_p(age ~ \"t.test\", test.args = age ~ list(var.equal = TRUE))","code":""},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tests.html","id":"custom-functions","dir":"Reference","previous_headings":"","what":"Custom Functions","title":"Tests/methods available in add_p() and add_difference() — tests","text":"report p-value (difference) test available gtsummary, can create custom function. output data frame one line long. structure similar output broom::tidy() typical statistical test. add_p() add_difference() functions look columns called \"p.value\", \"estimate\", \"statistic\", \"std.error\", \"parameter\", \"conf.low\", \"conf.high\", \"method\". can also pass Analysis Results Dataset (ARD) object results custom result. objects follow structures outlined {cards} {cardx} packages. Example calculating p-value t-test assuming common variance groups. custom add_difference() similar, accepts arguments conf.level= adj.vars= well.","code":"ttest_common_variance <- function(data, variable, by, ...) { data <- data[c(variable, by)] %>% dplyr::filter(complete.cases(.)) t.test(data[[variable]] ~ factor(data[[by]]), var.equal = TRUE) %>% broom::tidy() } trial[c(\"age\", \"trt\")] %>% tbl_summary(by = trt) %>% add_p(test = age ~ \"ttest_common_variance\") ttest_common_variance <- function(data, variable, by, conf.level, ...) { data <- data[c(variable, by)] %>% dplyr::filter(complete.cases(.)) t.test(data[[variable]] ~ factor(data[[by]]), conf.level = conf.level, var.equal = TRUE) %>% broom::tidy() }"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tests.html","id":"function-arguments","dir":"Reference","previous_headings":"","what":"Function Arguments","title":"Tests/methods available in add_p() and add_difference() — tests","text":"tbl_summary() objects, custom function passed following arguments: custom_pvalue_fun(data=, variable=, =, group=, type=, conf.level=, adj.vars=). function may utilize arguments, arguments passed function must accept . recommend including ... future-proof updates additional arguments added. following table describes argument inputs gtsummary table type.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Available gtsummary themes — theme_gtsummary","title":"Available gtsummary themes — theme_gtsummary","text":"following themes available use within gtsummary package. Print theme elements theme_gtsummary_journal(set_theme = FALSE) |> print(). Review themes vignette details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Available gtsummary themes — theme_gtsummary","text":"","code":"theme_gtsummary_journal( journal = c(\"jama\", \"lancet\", \"nejm\", \"qjecon\"), set_theme = TRUE ) theme_gtsummary_compact(set_theme = TRUE, font_size = NULL) theme_gtsummary_printer( print_engine = c(\"gt\", \"kable\", \"kable_extra\", \"flextable\", \"huxtable\", \"tibble\"), set_theme = TRUE ) theme_gtsummary_language( language = c(\"de\", \"en\", \"es\", \"fr\", \"gu\", \"hi\", \"is\", \"ja\", \"kr\", \"mr\", \"nl\", \"no\", \"pt\", \"se\", \"zh-cn\", \"zh-tw\"), decimal.mark = NULL, big.mark = NULL, iqr.sep = NULL, ci.sep = NULL, set_theme = TRUE ) theme_gtsummary_continuous2( statistic = \"{median} ({p25}, {p75})\", set_theme = TRUE ) theme_gtsummary_mean_sd(set_theme = TRUE) theme_gtsummary_eda(set_theme = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Available gtsummary themes — theme_gtsummary","text":"journal String indicating journal theme follow. One c(\"jama\", \"lancet\", \"nejm\", \"qjecon\"). Details . set_theme (scalar logical) Logical indicating whether set theme. Default TRUE. FALSE named list theme elements returned invisibly font_size (scalar numeric) Numeric font size compact theme. Default 13 gt tables, 8 output types print_engine String indicating print method. Must one \"gt\", \"kable\", \"kable_extra\", \"flextable\", \"tibble\" language (string) String indicating language. Must one \"de\" (German), \"en\" (English), \"es\" (Spanish), \"fr\" (French), \"gu\" (Gujarati), \"hi\" (Hindi), \"\" (Icelandic),\"ja\" (Japanese), \"kr\" (Korean), \"nl\" (Dutch), \"mr\" (Marathi), \"\" (Norwegian), \"pt\" (Portuguese), \"se\" (Swedish), \"zh-cn\" (Chinese Simplified), \"zh-tw\" (Chinese Traditional) language missing translation word phrase, please feel free reach GitHub translated text. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. iqr.sep (string) String indicating separator default IQR tbl_summary(). decimal.mark= NULL, iqr.sep= \", \". comma separator, however, can look odd decimal.mark = \",\". case argument default en dash ci.sep (string) String indicating separator confidence intervals. decimal.mark= NULL, ci.sep= \", \". comma separator, however, can look odd decimal.mark = \",\". case argument default en dash statistic Default statistic continuous variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":"themes","dir":"Reference","previous_headings":"","what":"Themes","title":"Available gtsummary themes — theme_gtsummary","text":"theme_gtsummary_journal(journal) \"jama\" Journal American Medical Association Round large p-values 2 decimal places; separate confidence intervals \"ll ul\". tbl_summary() show percent symbol; use em-dash separate IQR; run add_stat_label() tbl_regression()/tbl_uvregression() show coefficient CI column \"lancet\" Lancet Use mid-point decimal separator; round large p-values 2 decimal places; separate confidence intervals \"ll ul\". tbl_summary() show percent symbol; use em-dash separate IQR \"nejm\" New England Journal Medicine Round large p-values 2 decimal places; separate confidence intervals \"ll ul\". tbl_summary() show percent symbol; use em-dash separate IQR \"qjecon\" Quarterly Journal Economics tbl_summary() percentages rounded one decimal place tbl_regression(),tbl_uvregression() add significance stars add_significance_stars(); hides CI p-value output flextable huxtable output, coefficients' standard error placed . gt, placed right. theme_gtsummary_compact() tables printed gt, flextable, kableExtra, huxtable compact smaller font size reduced cell padding theme_gtsummary_printer(print_engine) Use theme permanently change default printer. theme_gtsummary_continuous2() Set continuous variables summary type \"continuous2\" default theme_gtsummary_mean_sd() Set default summary statistics mean standard deviation tbl_summary() Set default continuous tests add_p() t-test ANOVA theme_gtsummary_eda() Set continuous variables summary type \"continuous2\" default tbl_summary() show median, mean, IQR, SD, Range default Use reset_gtsummary_theme() restore default settings Review themes vignette create themes.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Available gtsummary themes — theme_gtsummary","text":"","code":"# Setting JAMA theme for gtsummary theme_gtsummary_journal(\"jama\") #> Setting theme \"JAMA\" # Themes can be combined by including more than one theme_gtsummary_compact() #> Setting theme \"Compact\" trial |> select(age, grade, trt) |> tbl_summary(by = trt) |> as_gt() Characteristic Drug A N = 98 Drug B N = 102 Age, Median (IQR) 46 (37 – 60) 48 (39 – 56)    Unknown 7 4Grade, n (%)     I 35 (36) 33 (32)    II 32 (33) 36 (35)    III 31 (32) 33 (32) # reset gtsummary themes reset_gtsummary_theme()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tibble_as_cli.html","id":null,"dir":"Reference","previous_headings":"","what":"Print tibble with cli — tibble_as_cli","title":"Print tibble with cli — tibble_as_cli","text":"Print tibble data frame using cli styling formatting.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tibble_as_cli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print tibble with cli — tibble_as_cli","text":"","code":"tibble_as_cli(x, na_value = \"\", label = list(), padding = 3L)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tibble_as_cli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print tibble with cli — tibble_as_cli","text":"x (data.frame) data frame character columns. na_value (string) string indicating NA value appear printed table. label (named list) named list column labels use. Default print column names. padding (integer) integer indicating amount padding columns.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tibble_as_cli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print tibble with cli — tibble_as_cli","text":"","code":"trial[1:3, ] |> dplyr::mutate_all(as.character) |> gtsummary:::tibble_as_cli() #> trt age marker stage grade response death ttdeath trt #> Drug A 23 0.16 T1 II 0 0 24 age #> Drug B 9 1.107 T2 I 1 0 24 marker #> Drug A 31 0.277 T1 II 0 0 24 stage"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/trial.html","id":null,"dir":"Reference","previous_headings":"","what":"Results from a simulated study of two chemotherapy agents — trial","title":"Results from a simulated study of two chemotherapy agents — trial","text":"dataset containing baseline characteristics 200 patients received Drug Drug B. Dataset also contains outcome tumor response treatment.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/trial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Results from a simulated study of two chemotherapy agents — trial","text":"","code":"trial"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/trial.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Results from a simulated study of two chemotherapy agents — trial","text":"data frame 200 rows–one row per patient trt Chemotherapy Treatment age Age marker Marker Level (ng/mL) stage T Stage grade Grade response Tumor Response death Patient Died ttdeath Months Death/Censor","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/vec_to_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert character vector to data frame — vec_to_df","title":"Convert character vector to data frame — vec_to_df","text":"used selecting allow , example as_gt(include=) can use tidyselect select among call names include.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/vec_to_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert character vector to data frame — vec_to_df","text":"","code":"vec_to_df(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/vec_to_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert character vector to data frame — vec_to_df","text":"x character vector","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/vec_to_df.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert character vector to data frame — vec_to_df","text":"data frame","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-development-version","dir":"Changelog","previous_headings":"","what":"gtsummary (development version)","title":"gtsummary (development version)","text":"Updates handling footnotes. Previously, header footnotes handled modify_footnote() modify_table_styling(footnote). possible also include footnotes table body modify_table_styling(footnote), largely hidden feature. Also confusingly, special abbreviation footnote handled modify_footnote(abbreviation=TRUE). update, now export separate user-facing functions clearer names scope: modify_footnote_header(), modify_footnote_body(), modify_abbreviation(). names indicate, modify_footnote_header() modify_footnote_body() functions place footnotes header table body. Abbreviations now treated like source notes footnote markers associated . also export functions remove_footnote_header(), remove_footnote_body(), remove_abbreviation() remove previously assigned footnotes abbreviations. Also, multiple footnotes may now reference cell table column header utilizing modify_footnote_header(replace=FALSE), modify_footnote_body(replace=FALSE) argument. Previously, source notes undocumented feature single source note included table. now export modify_source_note() remove_source_note() add remove number source notes. Also, merging stacking tables, previously due one source note limit, first source note retained. Now source notes included resulting table. different behavior compared previous versions package rare cases may result different source note. Moreover, kableExtra output now supports source notes, previously omitted.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-204","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.4","title":"gtsummary 2.0.4","text":"CRAN release: 2024-11-30","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-features-and-functions-2-0-4","dir":"Changelog","previous_headings":"","what":"New Features and Functions","title":"gtsummary 2.0.4","text":"Added S3 methods add_overall.tbl_hierarchical() add_overall.tbl_hierarchical_count(). Added tidy_wald_test(vcov) argument allow calculation p-values via alternative variance-covariance structure (e.g. robust SEs). (#2076; @aghaynes)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-2-0-4","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 2.0.4","text":"with_gtsummary_theme() updated longer print theme names applied, original theme re-applied. (#2031) Updated theme_gtsummary_journal(\"jama\") theme apply changes tbl_svysummary(). (#1964; @vjcatharine)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"lifecycle-updates-2-0-4","dir":"Changelog","previous_headings":"","what":"Lifecycle Updates","title":"gtsummary 2.0.4","text":"Removed global_pvalue_fun.tidycrr(), previously migrated {tidycmprsk} package. (#1997; @jwoolfolk)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-2-0-4","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 2.0.4","text":"Bug fix footnote markers placing footnote flextable gt tables multiple columns rows table body. (#2062) Fix setting default formatting functions tbl_svysummary(). Previously, defaults assigned similarly tbl_summary(), led survey-statistics assigned sub-optimal defaults. (#2078) Bug fix add_ci.tbl_svysummary() factor variables order alphabetical instead factor levels. (#2036) Addressing encoding issue sort() dplyr::arrange() sorted differently, order levels inconsistent resulting table. (#2038) Users may now pass vector integers tbl_hierarchical*(digits), possible summary functions. (#2080)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-203","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.3","title":"gtsummary 2.0.3","text":"CRAN release: 2024-10-04","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-features-and-functions-2-0-3","dir":"Changelog","previous_headings":"","what":"New Features and Functions","title":"gtsummary 2.0.3","text":"Added function tbl_hierarchical(), tbl_hierarchical_count(), tbl_ard_hierarchical(), brdg_hierarchical(), pier_summary_hierarchical(). Consider functions preview. making changes without full deprecation cycle coming releases. (#1872) Adding style_*(prefix, suffix) label_style_*(prefix, suffix) adding string formatted results. arguments added p-value formatting functions. (#1690) Added argument tbl_ard_summary(overall). TRUE, ARD parsed primary ARD Overall ARD run tbl_ard_summary() |> add_overall(). (#1940) Added add_stat_label.tbl_ard_summary() method. (#1969)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-2-0-3","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 2.0.3","text":"Headers {gt} tables exported PDF support \\n line breaker. Previously, line breakers stripped header print.gtsummary() S3 method. apply users utilizing as_gt() customize tables. result, line breaking strip migrated as_gt(). (#1960) Migrated tbl_survfit.list(conf.level) tbl_survfit.data.frame(conf.level) confidence level passed survival::survfit(). Update tbl_ard_summary() better handle non-standard ARDs (.e. typical continuous categorical summaries) assigning default summary type. (#1991) Made oneway.test() available add_p.tbl_continuous(). (#1970) Removed deprecated 'aov' test tests.R file listing available tests. (#1970) Removed documentation add_overall.tbl_ard_summary(digits) argument, never meant part function. (#1975)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-2-0-3","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 2.0.3","text":"Bug fix add_overall.tbl_custom_summary() due extraneous argument passed tbl_custom_summary(). (#2027) Bug fix add_p.tbl_survfit() original call included tbl_survfit(type) specification. (#2002) Removed \"tbl_summary-arg:statistic\" theme incorrectly added tbl_continuous().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-202","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.2","title":"gtsummary 2.0.2","text":"CRAN release: 2024-09-05 Updates address regressions v2.0.0 release: default add_glance_*(glance_fun) function fixed mice models class 'mira'. (#1912) can report unweighted statistics headers tbl_svysummary() tables. (#1911) tbl_uvregression() properly handles variables specified include argument non-syntactic names. (#1932) NA values can specified add_stat_label(label) suppress statistic label placed. (#1937) Corrected bug tbl_cross() digits argument always passed accurately tbl_summary(). (#1943)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-2-0-2","dir":"Changelog","previous_headings":"","what":"Other updates","title":"gtsummary 2.0.2","text":"Themes Inline Text vignettes converted articles (, longer bundled package, still available website). total N now returned .$cards using cards::ard_total_n() function calculation. default headers tbl_ard_*() functions longer include counts, required data passed along ARD input. summary statistics '' variable longer required ARD functions tbl_ard_summary() tbl_ard_continuous(). tabulation summary statistics passed, available place header dynamically. (#1860) tbl_ard_wide_summary() function longer requires results cards::ard_attributes() create tables. (#1873) Added label argument functions tbl_ard_summary(), tbl_ard_wide_summary(), tbl_ard_continuous(). (#1850) add_glance*(glance_fun) argument’s default value updated S3 generic, allowing bespoke handling regression classes. (#1822) Added add_overall.tbl_ard_summary() S3 method. (#1848) Added function tbl_likert() summarizing ordered categorical (Likert scales) data well associated add_n.tbl_likert() S3 method. (#1660) Fix error warning condition messages containing curly brace pairs printed. Updated show_header_names() output include values may dynamically placed headers. Additionally, include_example quiet arguments deprecated. (#1696)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-201","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.1","title":"gtsummary 2.0.1","text":"CRAN release: 2024-08-17 Updates address regressions v2.0.0 release: Restore functionality inline_text.tbl_summary(column) argument specify level variable factor. (#1883) Correct order columns tbl_summary() variables ten levels. (#1877) Re-establishing strong link header variable levels table body ensure correct ordering columns tbl_summary(). tbl_survfit(times) argument accepts integers . (#1867) Fix tbl_uvregression() formula argument includes hard-coded column name, e.g. formula='{y} ~ {x} + grade'. hard-coded variable name now removed include argument. (#1886) Fix non-Base R classes tabulated tbl_summary() coerce character correctly unlist(). (#1893) Updated styling function style_percent() style_number(scale=100) user passes integer change rounding percentages tbl_summary(). (#1899)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-2-0-1","dir":"Changelog","previous_headings":"","what":"Other updates","title":"gtsummary 2.0.1","text":"{tidycmprsk} dependency removed tbl_regression.tidycrr() method migrated {tidycmprsk} package. (#1865) class tbl_split() objects updated \"tbl_split\" c(\"tbl_split\", \"list\"). (#1854) Updated default value tbl_ard_summary(missing) \"\". (#1857) Line breaks (.e. '\\n') now auto-stripped gt-rendered tables R markdown Quarto environment. (#1896)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-200","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.0","title":"gtsummary 2.0.0","text":"CRAN release: 2024-07-23","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-features-2-0-0","dir":"Changelog","previous_headings":"","what":"New Features","title":"gtsummary 2.0.0","text":"Clearer error messages introduced throughout package. ’ve adopted {cli} messaging users. goal return clear message users scenarios. Added functions tbl_wide_summary() tbl_ard_wide_summary() simple summaries across multiple columns. {gt} package now default printer Quarto R markdown output formats. Previously, printing gtsummary table Quarto R markdown document, detect output format convert gt, flextable, kable provide best-looking table. {gt} package matured provides lovely tables nearly output types, now made {gt} default table drawing tool gtsummary tables. output types still supported. Previously, wanted single statistic reported additional levels precision tbl_summary() table, need specify precision every summary statistic variable. Now, can simple update one statistic ’re interested named list vector: tbl_summary(digits = age ~ list(sd = 2)). New functions tbl_ard_summary() tbl_ard_continuous() added. provide general tools creating bespoke summary tables. Rather accepting data frame, functions accept ARD object (Analysis Results Dataset often created {cards} {cardx} packages). ARD objects align emerging CDISC Analysis Results Standard. ARDs now used throughout package. See “Internal Storage” heading. default add_global_p(anova_fun) argument value updated global_pvalue_fun(), S3 generic. default method still calls car::Anova() calculation. Methods tidycmprsk::crr() geepack::geeglm() added wrap aod::wald.test() regression model types supported car::Anova(). add_ci.tbl_summary() S3 method updated new ways calculate confidence interval: Wald without continuity correction, Agresti-Coull, Jeffreys. Added family function label_style_*() similar style_*() except return styling function, rather styled value. Functions tbl_summary() tbl_svysummary() gained missing_stat argument, gives users great control statistics presented missing row summary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"internal-storage-2-0-0","dir":"Changelog","previous_headings":"","what":"Internal Storage","title":"gtsummary 2.0.0","text":"Greater consistency put place calculated statistics gtsummary. Previously, function handled calculations transforming statistics data frames printed. Now function first prepare Analysis Result Dataset (ARD), ARDs converted gtsummary structures using bridge functions (prefixed brdg_*()). bridge functions exported allow anyone easily extend gtsummary functions. ARDs now used calculate summary statistics nearly every function gtsummary. raw summary statistics saved .$cards. Users previously accessed internals gtsummary object find structure updated, may important breaking change. Calculations require packages placed another package called {cardx}. package creates ARD objects calculated statistics. tbl_regression(), .$model_obj longer returned object. modeling object , always , available .$inputs$x. gtsummary package first written, gt package CRAN version package available ability merge columns. Due limitations, \"ci\" column added show combined \"conf.low\" \"conf.high\" columns. Column merging gt gtsummary packages matured years, now adopting modern approach using features. result, \"ci\" column eventually dropped .$table_body. using column merging, conf.low conf.high remain numeric can continue update columns formatted. Review ?deprecated_ci_column details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"documentation-2-0-0","dir":"Changelog","previous_headings":"","what":"Documentation","title":"gtsummary 2.0.0","text":"vignettes “FAQ+Gallery”, tbl_summary() Tutorial, tbl_regression() Tutorial, Quarto+R Markdown converted articles. URLs website changed pages, vignettes longer bundled package. change allows us provide better documentation, utilizing tools don’t need included package.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"minor-improvements-2-0-0","dir":"Changelog","previous_headings":"","what":"Minor Improvements","title":"gtsummary 2.0.0","text":"Argument add_p.tbl_summary(adj.vars) added easily add p-values adjusted/stratified columns data frame. Messaging checks improved tidyselect invoked package, .e. tilda used select variables age ~ \"Patient Age\". subset variables can selected now reduced variables present table. example, summary table patient age (patient age), age single column data set many columns mis-spell age (aggge ~ \"Patient Age\"), error message now ask meant \"age\" instead listing every column data set. Note , can circumvent tidyselect using named list, e.g. list(age = \"Patient Age\"). Added following methods calculating differences add_difference.tbl_summary(): Hedge’s G, Paired data Cohen’s D, Paired data Hedge’s G. three powered {effectsize} package. counts header tbl_summary() tables now appear new line, e.g. \"**{level}** \\nN = {n}\". tbl_summary(), default calculation quantiles (e.g. statistics form \"p25\" \"p75\") updated type quantile(type=2). tbl_summary(), dates times showed minimum maximum values default. now treated continuous summaries share default statistics median IQR. Previously, indentation handled modify_table_styling(text_format = c(\"indent\", \"indent2\")), indent cell 4 8 spaces, respectively. Handling indentation migrated modify_table_styling(indent = integer()), default, label column indented zero spaces. makes easier indent group rows. inputs modify_table_styling(undo_text_format) updated mirror counterpart modify_table_styling(text_format) longer accepts TRUE FALSE. values passed tbl_summary(value) now checked columns summary type \"dichotomous\". gtsummary selecting functions, e.g. all_categorical(), all_continuous(), etc., now simplified wrapping tidyselect::(), available functions originally written. Previously, functions error used context; now, instead,select columns used --context. design-based t-test added possible methods add_difference.tbl_svysummary() now default continuous variables. add_ci() run add_overall(), overall column now populated confidence interval. (#1569) Added pkgdown_print.gtsummary() method registered pkgdown package loaded. enables printing gtsummary tables pkgdown site Examples section. (#1771) package now uses updated survey::svyquantile() function calculate quantiles, introduced survey v4.1","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-2-0-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"gtsummary 2.0.0","text":"Fix add_difference() paired t-tests. Previously, sign reported difference depended group appeared first source data. Function updated consistently report difference first group mean minus second group mean. (#1557)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"lifecycle-changes-2-0-0","dir":"Changelog","previous_headings":"","what":"Lifecycle changes","title":"gtsummary 2.0.0","text":"couple small changes default summary type tbl_summary() made. column NA_character_ tbl_summary(), default summary type now \"continuous\", previously \"dichotomous\". Previously, tbl_summary() variables c(0, 1), c(\"\", \"yes\"), c(\"\", \"Yes\"), c(\"\", \"YES\") default dichotomous summary 1 yes level shown table. occur even case , example, 0 observed. release, line shown dichotomous variables must observed unobserved level must either explicitly defined factor logical vector. means character vector \"yes\" \"\" values default categorical summary instead dichotomous. using tbl_summary(value) argument, longer allow unobserved levels used unless unobserved factor level logical level. quiet argument deprecated throughout package, except tbl_stack(). Documentation updated ensure clarity methods. inline_text(level) argument now expects character value. tbl_butcher(include) argument now accepts character vectors. following theme elements deprecated: pvalue_fun elements switch package-wide theme p-value styling–'pkgwide-fn:pvalue_fun'. default statistics can still modified 'tbl_summary-arg:statistic' add_p(test = ~'aov') test now deprecated identical results can obtained add_p(test = ~'oneway.test', test.args = ~list(var.equal = TRUE)). Previously, add_p.tbl_summary() coerce various data types classes compatible base R tests. example, convert difftime classes general numeric passing wilcox.test(). eliminated type- class-specific handling functions now left user pass data compatible functions calculate p-values create custom test wraps wilcox.test() performs conversion. change effective immediately. Arguments modify_header(update), modify_footnote(update), modify_spanning_header(update), modify_fmt_fun(update) deprecated. Use dynamic dots instead, e.g. modify_header(...), preferred method passing updates years. Function continuous_summary() deprecated immediately. Apologies inconvenience immediate deprecation. way function originally worked compatible updated internal structures. cases, users can use tbl_continuous() function instead. Arguments add_stat(fmt_fun, header, footnote, new_col_name) deprecated since v1.4.0 (2021-04-13). now fully removed package. Global options deprecated gtsummary since v1.3.1 (2020-06-02). now fully removed package. modify_header(stat_by) argument deprecated v1.3.6 (2021-01-08), now fully removed package. Use vars() selector first removed v1.2.5 (2020-02-11), messaging deprecation kicked June 2022. use now defunct function soon longer exported. as_flextable() function deprecated v1.3.3 (2020-08-11), now fully removed package. Custom selectors all_numeric(), all_character(), all_integer(), all_double(), all_logical(), all_factor() functions deprecated v1.3.6 (2021-01-08), now fully removed package. functions added tidyselect::() function released, replacement functions. modify_cols_merge() functions renamed modify_column_merge() match function names v1.6.1 (2022-06-22). deprecation upgraded warning error. change theme_gtsummary_journal(\"qjecon\") theme gt output. journal prefers present regression coefficients standard errors. achieve placement gt table, taking advantage bug feature (depending point view) allowed placement gt table output HTML HTML . gt package now working proper solution linebreaks within cell, feature active, using hack. change theme tabling engine packages.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-172","dir":"Changelog","previous_headings":"","what":"gtsummary 1.7.2","title":"gtsummary 1.7.2","text":"CRAN release: 2023-07-15 Removed messaging former auto-removal tbl_summary(group) variable table: change occurred 3+ years ago gtsummary v1.3.1 Fix as_flex_table() source notes accurately rendered. (#1520) Fix column order add_ci() run add_overall(last=TRUE). Previously, overall columns placed front. (#1525) Line breaks (.e. \\n) now removed column headers table cells as_kable() called. (#1526) Fix as_gt() columns common spanning headers gathered. Corrected gt::tab_spanner(gather = FALSE). (#1527) Fix remove_row_type() header rows continuous2 type variables removed requested. (#1507) Fix default add_p.tbl_summary() categorical tests chi-squared Fisher’s exact test. misclassification occurred cases large differential missing pattern one variables cross table. (#1513) Fix add_overall(col_label=) specified label always placed. (#1505)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-171","dir":"Changelog","previous_headings":"","what":"gtsummary 1.7.1","title":"gtsummary 1.7.1","text":"CRAN release: 2023-04-27","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-7-1","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.7.1","text":"Added .data.frame() S3 method gtsummary class.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-7-1","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.7.1","text":"tbl_svysummary() function may now report design effect, e.g. tbl_svysummary(statistic = ~\"{deff}\"). (#1486) Added French translations new marginal effects tidiers housed {broom.helpers}. (#1417) Added theme elements control default headers tbl_svysummary(). (#1452) Improved error messaging tbl_uvregression() method= argument correctly specified. (#1469) Updates account changes {forcats} v1.0.0 {dplyr} v1.1.0. tbl_svysummary() can now report design effects (#1486)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-7-1","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.7.1","text":"Fix footnote add_overall() run tbl_continuous(). (#1436) Updating levels precision used round2(), used background every rounded/formatted number gtsummary table. (#1494) Bug fix subset CIs requested add_ci(include=). (#1484) Update as_hux_table() ensure Ns header incorrectly auto-formatted {huxtable}. Fix style_*() family functions. attributes input vector–excluding class–retained. (#1460) Updated style_ratio() now format negative values. Bug fix add_ci.tbl_svysummary() dichotomous variables. add_ci.tbl_svysummary() now takes properly account percent argument (#1470)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-170","dir":"Changelog","previous_headings":"","what":"gtsummary 1.7.0","title":"gtsummary 1.7.0","text":"CRAN release: 2023-01-13","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-7-0","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.7.0","text":"Updated default argument values tidy_robust(vcov=NULL, vcov_args=NULL). Users must specify type robust standard errors using arguments. Fully removed deprecated items originally deprecated v1.2.5 (released 3 years ago). add_p(exclude=), as_gt(exclude=), as_kable(exclude=), as_tibble.gtsummary(exclude=), tbl_regression(exclude=), tbl_uvregression(exclude=) tbl_summary_(),add_p_() add_global_p(terms=)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-7-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.7.0","text":"New function add_ci.tbl_svysummary() adding confidence intervals tbl_svysummary() summary statistics. (#965)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-7-0","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.7.0","text":"Arguments pass via dots tbl_uvregression(...) now passed broom.helpers::tidy_plus_plus(...). (#1396) Added new theme elements control default headers tbl_summary(). (#1401) examples previously used
line breaks gt tables updated use \\n. Additionally, \"qjecon\" journal theme updated use updated line breaker well. (#1311) Now allowing mixed-class numeric types tbl_summary(), inline_text() throw error pattern argument specified. Added stats::mood.test() add_p.tbl_summary(). (#1397)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-documentation-1-7-0","dir":"Changelog","previous_headings":"","what":"New Documentation","title":"gtsummary 1.7.0","text":"Added new article illustrating place gtsummary tables Shiny applications. (#1335)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-7-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.7.0","text":"Updated Lancet journal theme report p-values precision, per journal’s reporting guidelines. (#1442) Fix as_flex_table() header blank. (#1406) Fix tbl_summary() now allows column vectors named within data frame. (#1403)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-163","dir":"Changelog","previous_headings":"","what":"gtsummary 1.6.3","title":"gtsummary 1.6.3","text":"CRAN release: 2022-12-06 as_flex_table() function now recognizes markdown bold (**) italic (_) syntax headers spanning headers. Restrictions apply. See help file details. Users can longer place sets double stars underscores without text formatted markdown syntax. (#1361) modify_caption() function now works tables created gtreg::tbl_listing() contain column named \"label\". (#1358) Functions tbl_summary() tbl_svysummary() now support \"{n}\", \"{p}\", \"{level}\" = variable present use functions like modify_header(). example, following previously invalid code works well overall column stratified columns: survey summary, unweighted variants also available. (#1366) Added experimental feature additional arguments can passed broom.helpers::tidy_plus_plus() via tbl_regression(...). (#1383) Updated arguments tidy_robust() account updates {parameters}. (#1376) Allowing ‘survfit’ objects class survfit2 add_nevent.tbl_survfit(). (#1389) Added oneway.test() test add_p(). (#1382) Now using {ggstats} plot regression model coefficients via plot() instead {GGally}. (#1367) Bug fix tbl_custom_summary(): full dataset (including missing observations) now properly passed full_data (#1388)","code":"trial %>% tbl_summary(by = trt) %>% add_overall() %>% modify_header(all_stat_cols() ~ \"**{level}**, N = {n}\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-162","dir":"Changelog","previous_headings":"","what":"gtsummary 1.6.2","title":"gtsummary 1.6.2","text":"CRAN release: 2022-09-30 following updates made indentation implementation gt output: Previously, HTML output able indent gt tables, implemented via gt::tab_style(). Indentation now available HTML, PDF, Word implemented adding unicode non-breaking spaces data frame via gt::text_transform(). “names” indentation calls updated \"indent\" \"indent2\". change affect users. ’re sure names refer , affect . Indentation RTF currently work. Instead indented columns, irregular unicode characters shown. issue addressed future gt release. use RTF output, like output identical update, use as_gt(include = -indent). link cheat sheet added website’s navigation bar. Added additional options remove_row_type(type = c(\"level\", \"\")). Use type = \"\" remove rows associated variable(s) specified remove_row_type(variables=). Use type = \"level\" conjunction new argument level_values= remove specified levels variable, use new argument remove levels categorical variables. Added standard error means list available statistics continuous data summaries tbl_svysummary(). (#1291) Added Dutch language translations. (#1302) Updated add_significance_stars() accept gtsummary table (instead regression model summaries) work add_global_p() (#1320) Added \"var_type\" hidden column output tbl_survfit(). addition ensures table work remove_row_type(). (#1343) Updated calls round() style_*() functions round2(), implements classic rounding rules. (#1304) Fixed bug style_sigfig() numbers close thresholds. (#1298) Fixed bug column named \"variable\" passed tbl_custom_summary(=), resulted error. (#1285) Bug fix as_tibble(fmt_missing = TRUE). Previously, missing assignments applied one row ignored. (#1327) Bug fix column alignment tbl_stack() as_kable_extra() output. (#1326)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-161","dir":"Changelog","previous_headings":"","what":"gtsummary 1.6.1","title":"gtsummary 1.6.1","text":"CRAN release: 2022-06-22","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-6-1","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.6.1","text":"Added standard error proportions list available statistics categorical data summaries tbl_svysummary(). (#1187) Added Tarone-Ware test add_p.tbl_survfit() (#732) Updated add_global_p() handle tbl_uvregression() objects users specified x= argument (y= argument common). (#1260)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-6-1","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.6.1","text":"Updated start-messaging. (#1228) paired.wilcox.test available add_p.tbl_summary() add_difference.tbl_summary() mistakenly marked returning difference, . documentation corrected, results improved messaging user test selected add_difference(). (#1279) Improved error messages paired tests add_p() add_difference() group= argument specified. (#1273) Added argument with_gtsummary_theme(msg_ignored_elements=) argument. Use argument message users theme elements overwritten therefore ignored inside with_gtsummary_theme() call. (#1266) Swapped gt::fmt_missing() gt::sub_missing() former now deprecated. (#1257) checks \"haven_labelled\" class now performed variables indicated include= = tbl_summary() tbl_svysummary(). checks tbl_uvregression() tbl_survfit.data.frame() applied variables include=, e.g. checking outcome variable(s). Updates labels default formatting functions unweighted statistics presented tbl_svysummary(). (#1253) Adding additional structural checks tbl_merge() inline_text() provide better error messaging. (#1248) Added tbl_regression.crr() method messaging recommending use tidycmprsk::crr() instead. (#1237) experimental support ftExtra::colformat_md() as_flex_table() removed. function requires evaluated YAML paths allow un-evaluated references like bibliography:: \"`r ::()`\". (#1229) Update tbl_summary(=) now allows column named \"variable\" passed. (#1234) Added theme element control missing statistic shown summary tables options display number percent missing non-missing total number observations. (#1224) Renamed modify_cols_merge() modify_column_merge() inline modify_column_*() functions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-6-1","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.6.1","text":"Fix as_kable_extra() output format 'latex' cell bold italicized special characters double-escaped. Added condition escape special characters styled cells. (#1230) Fix with_gtsummary_theme(). function restored previously set theme, inadvertently included temporary theme along .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-160","dir":"Changelog","previous_headings":"","what":"gtsummary 1.6.0","title":"gtsummary 1.6.0","text":"CRAN release: 2022-04-25","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"improvements-to-as_kable_extra-1-6-0","dir":"Changelog","previous_headings":"","what":"Improvements to as_kable_extra()","title":"gtsummary 1.6.0","text":"users used default kableExtra print without output-specific formatting, breaking changes…changes improved output styling. Markdown bold, italic, underline syntax headers, spanning headers, caption, footnote converted escaped LaTeX code. Special LaTeX characters body table escaped .escape_latex() .escape_latex2(), e.g. % updated \\\\%, rendered % PDF document. “” symbol recognized line break table headers, spanning headers, caption, table body. \\n removed footnotes escape= argument now passed kableExtra::add_header_row() kableExtra::footnote() well (previously, passed knitr::kable()). as_kable_extra(escape=, format=) arguments made explicit, previously, arguments passed via .... Breaking Change default value escape= now FALSE. users previously used as_kable_extra(escape=FALSE) manually escaped LaTeX/HTML characters body table, characters now double escaped. print table without auto-escaping now present, utilize new argument as_kable_extra(addtl_fmt=FALSE) Breaking Change fmt_missing= argument added as_tibble(), as_kable(), as_kable_extra() last release. argument now deprecated as_kable() as_kable_extra(). user want missing values formatted, can exclude commands include= argument. Breaking Change strip_md_bold= deprecated. markdown syntax automatically stripped headers, unless escape = FALSE format = \"latex\". case, markdown syntax converted LaTeX commands. default markdown syntax headers spanning headers removed. Special characters table body, headers, spanning headers, caption, footnote escaped .escape_html(). \"\\n\" symbol removed footnotes","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"improvements-to-as_flex_table-1-6-0","dir":"Changelog","previous_headings":"","what":"Improvements to as_flex_table()","title":"gtsummary 1.6.0","text":"Added support markdown syntax {flextable} header rows utilizing {ftExtra} package. package installed options(gtsummary.use_ftExtra = TRUE) set (equivalent theme element), bold/italic markdown syntax found headers styled. Otherwise, markdown syntax stripped header rows. (#1200)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-6-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.6.0","text":"New function as_hux_xlsx() added export formatted {gtsummary} table directly Excel. Added tbl_regression.tidycrr() method summarize competing risks regression models. (#1169) Added tidier tidy_wald_test(), generic function can calculate Wald test statistics groups variables model. tidier expects model object supported vcov() coef() obtain variance-covariance matrix coef vector. Adding functions get_gtsummary_theme() with_gtsummary_theme() extracting current gtsummary theme running code temporarily theme. Added new function modify_column_indent()–wrapper modify_table_styling()–make easier add remove indentation table. Now exporting function primarily used internally helper converting gtsummary table gt (formats): .table_styling_expr_to_row_number(). Theme helper function check_gtsummary_theme() added. function takes gtsummary theme list input, runs various consistency checks. Useful constructing personalized theme. function replaces internal checks passed theme element indeed valid theme element.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-6-0","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.6.0","text":"Functions bold_labels(), bold_levels(), italicize_labels(), italicize_levels() now method functions can work better tbl_cross() objects. Total overhaul way statistics saved reported modify_header(), modify_spanning_header(), modify_footnote(), modify_caption(). now standardized place statistics saved gtsummary tables (x$table_styling$header columns starting \"modify_stat_\"). modify functions updated access statistics header data frame. added benefit structure, statistics available tables merged stacked. Statistics available modify_caption() taken \"label\" column. (#1165, #1101) Added add_global_p(anova_fun=) argument allowing users pass custom functions calculate global p-values car::Anova() support model type. (#1149) Functions bold_labels(), bold_levels(), italicize_labels(), italicize_levels() now bold/italicize first column shown table. Previously, \"label\" column (often first shown column) styled. Added theme element pass arguments knitr::kable() as_kable() as_kable_extra(). Updated default function add_glance_*(glance_fun=) MICE models. (#1137) Add tbl_butcher(keep=) argument optionally keep internal objects needed. (#1148) Adding Norwegian translations (#1143)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-6-0","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.6.0","text":"Removed use round() style_number(), replaced round function “round--even”. (#1140) Converted Table Gallery vignette FAQ+Gallery (#811) Added error messaging user tries run add_p() add_difference() twice. (#1209) models CIs labelled Confidence Interval. Now Bayesian models correctly label Credible Interval. (#1196) Improved error messaging functions as_gt(), as_kable(), as_flex_table(), as_hux_table() object class ‘gtsummary’ passed. (#1188) Deprecated as_huxtable(strip_md_bold=) {huxtable} now recognizes markdown syntax reason remove markdown syntax. Added huxtable::set_header_rows() as_hux_table() stack. Improved error messaging modify_*() functions. (#914) Added style_percent() default formatting function un-weighted proportions. (#1181) global options previously available now soft deprecated. documentation global options removed v1.3.1. (#1085) as_flextable() function upgraded soft hard deprecation; use as_flex_table() instead. longer removing survey design columns survey objects columns summarized tbl_svysummary() summarized tbl_uvregression(). users previously didn’t indicate variables summarize include=, design columns now appear summary tables. (#1166) Added check functions accept ... nothing passed .... bad misspelled argument found, users informed. (#1083)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-6-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.6.0","text":"Fix \"emmeans\" methods add_difference() due argument name change emmeans package. now require recent version package. (#1205) Bug fix inline_text.tbl_summary() one pass pattern column argument NULL. (#1193) Fix as_gt() hidden columns. Fix add_p.tbl_svysummary() Wald tests converted flextable. survey tidier saved column matrix-column instead vector, incompatible flextable output. (#1153) Fixing Lancet theme mid-point encoding issue Linux MacOS. (#1146) Fix using summary type gtsummary selectors (e.g. all_continuous()) add_ci(style_fun=) argument. (#1141)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-152","dir":"Changelog","previous_headings":"","what":"gtsummary 1.5.2","title":"gtsummary 1.5.2","text":"CRAN release: 2022-01-29 Removed foreign reference external functions top level package replaced indirect calls (reason short time releases). (#1129) Updates way footnotes printed tbl_summary() summary type \"continuous2\" present. Previously, footnotes removed, now \"continuous2\" footnotes removed. (#1127) Added continuous variable name/label footnote greater clarity tbl_continuous() (#1123) Now exporting .create_gtsummary_object() function utility packages build gtsummary tables. (#1130) Fix add_overall() run add_n(). overall row omitted sum Ns doubled. (#1126) Added method “emmeans” add_difference() tbl_svysummary() objects. Updated default add_difference() tbl_svysummary() objects “emmeans” continuous dichotomous variables, “smd” categorical variables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-151","dir":"Changelog","previous_headings":"","what":"gtsummary 1.5.1","title":"gtsummary 1.5.1","text":"CRAN release: 2022-01-20","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-5-1","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.5.1","text":"Added new function modify_column_alignment() updated column alignment. Function wrapper complex modify_table_styling() function. New function tbl_strata2() passes stratified data frame well stratum level user function. (#1091) Added add_p.tbl_continuous() method adding p-values tbl_continuous() tables. (#1023) Added add_overall.tbl_continuous() method. (#1037)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-5-1","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.5.1","text":"New test option “emmeans” add_difference() add_p() uses {emmeans} package estimate marginal means/least-squares means continuous variables, binary variables random intercept models. (#1112) Column alignment now recognized as_kable() as_kable_extra(). Previously, alignment utilized kable() defaults ignored alignment instructions included gtsummary table styling. as_kable_extra() updated utilize kableExtra::column_spec() kableExtra::cell_spec() apply bold italic styling. choice function depends use escape= knitr::kable() (#1107) Default arguments knitr::kable() may now overwritten passing ... either as_kable() as_kable_extra(). Previously, passing user-defined argument previously use result error. Added tbl_strata(.header=) argument providing greater control stratum headers added tables, e.g. can now add Ns headers using argument. Added add_p.tbl_cross(test.args=) argument. (#1095) tbl_strata(.combine_args=) added lets control arguments tbl_merge() tbl_stack() occurs tbl_strata(). (#1090) Added add_ci(pattern=) argument, makes easier merge CI column primary statistics column. (#1029) Suppress tbl_merge() spanning headers passing tbl_merge(tab_spanner = FALSE) (#1067) Functions as_tibble(), as_kable(), as_kable_extra() gain fmt_missing= argument applies missing symbols missing values. as_tibble() argument defaults FALSE, others’ default TRUE. (#1073) Adding tbl_regression(conf.int=) tbl_uvregression(conf.int=) argument. models, confidence interval adds computation time significantly may needed. argument omit CI calculation. (#1052) add_stat() function updated accept tbl_continuous() tables. Multinomial models computed using MICE now supported. (#1065) Added theme element control tbl_regression(conf.int=) default argument. now possible pass single tbl tbl_merge(). useful using tbl_merge() helper functions. (#1068) Added statistics= digits= arguments add_overall() family functions. (#1047) Added digits= argument tbl_cross(). (#1046)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-5-1","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.5.1","text":"Allowed modification font_size compact theme. (#1106) Automatically reduced vertical white space columns compact flextable theme. Improved user interface modify_*() functions (#1064) Improved error messaging throughout package. (#1050) Added link syntax help file functions throughout package. syntax help file illustrates use gtsummary selectors details formula-list notation. (#981) Updated Spanish translation Wilcoxon Rank-sum Test. Updates additions Portuguese language translations. (#1098) Updates French translations. Updating add_overall() S3 method common structure, e.g. add_overall(x, ....), previously, ... present. (#1066) Updated theme_gtsummary_journal(\"qjecon\") set tbl_regression(conf.int = FALSE) default. Improved error messaging tbl_custom_summary() Updated default formatting functions tbl_custom_summary(). Previously, summaries character results erred default summary function style_number(). updated style_sigfig() numeric columns, .character() everything else. (#983) style_*() functions retain attribute, names. (#1035, #1031, #981) add_n.tbl_regression() (also utilized tbl_uvregression()) adding N column without applying formatting function. style_number() function now added default styler. (#1022) Added class \"tbl_continuous\" output tbl_continuous(). Adding add_p() test \"mcnemar.test.wide\" calculate p-value data stored wide format, e.g. one column value second column . McNemar test variant available {gtsummary} expects data long format. Converted tbl_split() S3 function. Update calls gt::fmt_missing() constructed memory efficient.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-5-1","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.5.1","text":"Fix add_significance_stars() led error summarized model confidence interval column. Fix as_flex_table() as_hux_table() reference row properly placed tbl_merge() merged tables share common categorical variables different reference rows. (#1063) Fix inline_text.gtsummary() first level categorical variable selected table also processed remove_row_type(). (#1078) Fix modify_table_styling(cols_merge_pattern) used tbl_stack() followed tbl_merge(). (#1057) Bug fix separate_p_footnotes() test names translated theme_gtsummary_language() set. (#1055) Fix tbl_merge() rows merging table present first table. (#1033) Fix as_tibble() nnet::multinom() regression models. Fix tbl_continuous() include= specified. Fix tbl_regression() tidier returns CI columns missing. (#1012) Fix add_p()/add_difference() check whether passed test internal method custom method. previous code required Suggested packages, , {lme4}, {effectsize}, {survey}, installed. (#1018)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-5-1","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.5.1","text":"longer exporting assert_package(). migrated {broom.helpers} now use broom.helpers::.assert_package(). (#1051)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-150","dir":"Changelog","previous_headings":"","what":"gtsummary 1.5.0","title":"gtsummary 1.5.0","text":"CRAN release: 2021-10-16","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-5-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.5.0","text":"Added new function tbl_continuous() summarize continuous variable 1 categorical variables. Added new function add_ci() adds new column confidence interval proportions/means reported tbl_summary(). (#868) Migrated new function tbl_split() {bstfun} package. Function allows users split {gtsummary} table multiple tables. Migrated new function separate_p_footnotes() {bstfun} package. Function allows users separate composite footnote listing tests performed add_p(), replaces individual footnotes test name. New function tbl_custom_summary() allowing create table summary statistics using custom summary function (#973, #976) Set helpers used tbl_custom_summary(): continuous_summary(), proportion_summary(), ratio_summary() New function modify_cols_merge() can merge two columns {gtsummary} table. (#939) Added function tbl_butcher() reduce size {gtsummary} table. object butchered, {gtsummary} functions may able execute object. Added new function tidy_robust() add robust standard errors, confidence intervals, p-values tbl_regression() tbl_uvregression(). function wrapper parameters::model_paramters(). (#979)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-5-0","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.5.0","text":"Added CITATION file users can now cite R Journal manuscript using citation(\"gtsummary\"). Added Standardized Mean Difference method add_difference(), wrapping {smd} package’s calculations. (#966) Extended add_difference() accept tbl_svysummary() objects addition tbl_summary() objects. Added standardized mean difference method tbl_svysummary() tables. Added tbl_strata(.stack_group_header=) argument include/exclude headers tables combined tbl_stack() Added tbl_strata(.quiet=) argument. Allow add_p() add_difference() run table. (#959) Updated add_overall() include overall statistics df_stats tibbles saved .$meta_data. makes possible report overall statistics using inline_text(pattern=) argument.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-5-0","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.5.0","text":"Added help file detailing formula list notation used throughout {gtsummary} package. (#981) Updates tbl_regression() documentation. model N longer reported default, removed section help file. (#998) Updates make internal df_stats objects consistent across various {gtsummary} objects. Added internal function df_stats_to_table_body adds numeric df_stats tibble .$table_body. formatting functions also added new columns .$table_styling$fmt_fun. function now used inline_text.gtsummary() prepare returned statistics (#921) Now using broom::tidy() prepare car::Anova() results. stable version originally written. (#898) function assert_package() now takes minimum required version package DESCRIPTION file, function now exported. Now using broom::tidy() prepare aov() test results add_p.tbl_summary(), adds additional columns .$table_body() (#956) Updated README include links recording gtsummary presentation RStudio Education blog post. Removed maturing lifecycle tag README. Updated deprecated function workflows::pull_workflow_fit(x) workflows::extract_fit_parsnip(x).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-5-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.5.0","text":"Fix tbl_summary() factor variable passed NA specified levels. (#977) Fix add_p.tbl_summary() factor variable NA values passed. (#977) Bug fix add_difference(estimate_fun=) argument.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-5-0","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.5.0","text":"Updated add_p.tbl_summary(test = . ~ \"mcnemar.test\", group = id) syntax require group= argument align paired Wilcoxon rank-sum test paired t-test syntax. Deleted deprecated functions add_comparison(), add_global(), tab_style_bold_p(), tab_style_bold_labels(), tab_style_italicize_levels(), tab_style_italicize_labels(), tab_style_bold_levels(). following deprecated arguments removed: tbl_summary(group=), as_gt(omit=). survival package moved Imports Suggests, longer automatically installed {gtsummary} installed. Additionally, survival::Surv() longer re-exported package.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-142","dir":"Changelog","previous_headings":"","what":"gtsummary 1.4.2","title":"gtsummary 1.4.2","text":"CRAN release: 2021-07-13 Update internals tbl_stack() better handle two stacked tables stacked (#906) Updates make tbl_svysummary() compatible {survey} package updates v4.1 (#930) as_hux_table() function previously stripped markdown old syntax column headers spanning headers. output now uses markdown syntax headers default utilizing huxtable::set_markdown() (#885) Variables passed tbl_svysummary(=) argument now automatically added include=. (#925) Bold italic requests now ignored kableExtra output. carried via markdown syntax, supported {kableExtra} (#917) Bug fix add_p.tbl_cross(pvalue_fun=); argument ignored. Updated style_pvalue() format p-values slightly larger 1 slightly lower 0 (due imprecise numeric storage). (#907) Fix allowing factor vectors passed tbl_stack(group_header=). (#908) Updated arguments y= x= tbl_uvregression() allow non-standard names (#912)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-141","dir":"Changelog","previous_headings":"","what":"gtsummary 1.4.1","title":"gtsummary 1.4.1","text":"CRAN release: 2021-05-19 Updated tbl_regression() compatible models created {parsnip} {workflows} packages (#890, #647) Added modify_table_styling(text_format = \"indent2\") option double indent row. (#864) Messaging update inline_text.gtsummary() suspects variable repeated gtsummary table. (#855) Bug fix add_p.tbl_summary() columns NA. variables longer error; rather, message printed indicating p-value possible calculate. (#889) Updated tbl_svysummary() compatible {srvyr} package (#886) Updated default header using tbl_uvregression(x=) \"**Outcome**\" (#867) tbl_summary(=) variable now added include= default (#871) Variables converted numeric passed wilcox.test() add_p(). avoids error date difference passed. (#880) Bug fix {Hmisc} labeled data tbl_summary() (#876) Bug fix add_n.tbl_summary() proportion missing cases. (#903) Updates default formatting functions add_glance_*() functions. P-values now styled style_pvalue() . Obs. degrees freedom style_number() (#870)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-140","dir":"Changelog","previous_headings":"","what":"gtsummary 1.4.0","title":"gtsummary 1.4.0","text":"CRAN release: 2021-04-13","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-4-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.4.0","text":"Added new function add_glance_table() companion add_glance_source_note(). Function adds model statistics, R-squared, bottom model summary table. Added new function add_significance_stars() adding star indicators significant estimates explanatory footnote. Added new function tbl_strata(). function aids prepares gtsummary tables stratified one variables (#679) Adding coefficient plot() methods tbl_regression() tbl_uvregression(). Function creates forest plot model coefficients via GGally::ggcoef_plot(). New function modify_fmt_fun() introduced help update functions format numeric columns rows .x$table_body. New function introduced, modify_table_styling(), update printing instructions tables. function replaces modify_table_header(), now soft deprecated. Added function add_vif() include variance inflation factors tbl_regression() output. (#717) Added generic function inline_text.gtsummary() can report results gtsummary table. (#398)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-4-0","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.4.0","text":"Print infrastructure updated allow row column specification formatting data table styling. x$table_header object replaced general x$table_styling. Review updated vignette \"gtsummary_definition.Rmd\" details. x$table_body longer grouped tbl_stack(); rather, grouping variable specified gt::gt(groupname_col=) tbl_summary() now accepts class input. Previously non-date base classes accepted. non-base R classes, summary type must specified using tbl_summary(type=). default summary statistic dates/times minimum maximum. (#488) add_stat() function may now return multiple columns new statistics. arguments deprecated update. (#746) tbl_uvregression() now accepts data frames survey design objects input. (#742) default tidy_fun = broom::tidy fails, parameters::model_parameters() attempts tidy model, {parameters} installed. (#854) Added custom tidier mgcv::gam() models (tidy_gam()) method function (tbl_regression.gam()) uses new tidier default. (#745) Added default support brmsfit model tbl_regression() new method function. (#751) Functions modify_footnote() modify_spanning_header() now include text_interpret= argument indicating whether use gt::md() gt::html() format text. Default gt::md(). Added/updated functions add_n() add_nevent() work tbl_regression tbl_uvregression objects. function now argument place Ns label level rows. (#744) Added Quarterly Journal Economics theme_gtsummary_journal(). journal theme updated gt package updates cols_merge() rows argument allows line breaks within cell. Korean Icelandic language translations added theme_gtsummary_language(). Ability merge two columns modify_table_styling(cols_merge_pattern=) argument. Added theme element \"pkgwide-fun:pre_conversion\". function specified executed gtsummary object printed converted as_gt(), as_flex_table(), etc functions. (#773) modify_table_body(fun=) argument generalized accept formula shortcut notation. Added exploratory data analysis theme shows details default, theme_gtsummary_eda().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-4-0","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.4.0","text":"Updatedtbl_merge() tbl_stack() capture first source note caption merged/stacked tables. Previously, captions source notes lost. Added messaging table caption requested via modify_caption() gt table using version gt support captions. Updates table gallery vignette reflecting changes package. (#775) Improved error messaging problem constructing one univariate regression models tbl_uvregression(). Added variable-specific formatting add_difference(estimate_fun=) allowing single table show, example, mean rate differences formatted/rounded differently. Improved handling messaging users columns \"haven_labelled\" class passed gtsummary functions. (#805) Improved handling ordered factors = variable (#569, #540) Removed {usethis} package dependency replaced {cli}. (#768) Added survey-adapted t-test theme_gtsummary_mean_sd() continuous variables add_p.tbl_svysummary() (#758) Allowing tidyverse shortcut notation tbl_survfit(estimate_fun=) specification, e.g. tbl_survfit(estimate_fun= ~style_sigfig(.x * 100)) (#761) JAMA journal theme updated merge coefficient confidence interval columns. Updated inline_text() functions wrap inline_text.gtsummary()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-4-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.4.0","text":"label= argument unstratified models ignored tbl_survfit() (#842) Preserve ordering factor variables tbl_survfit(). (#764) Bug fix spanning headers kableExtra output. spanning header misplaced header text sandwiched two blank spanning headers. Bug fix displaying unobserved level factor variable dichotomously tbl_summary(). (#780) Bug fix add_p() test name footnote translated theme_gtsummary_language().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-4-0","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.4.0","text":"tbl_survival() moved questioning deprecated. function maintains old x$table_header format (instead flexible x$table_styling). \"level_label\" column renamed \"groupname_col\" x$table_body longer grouped group_by(level_label) back-end implementation add_stat_label(location = \"row\") updated. function now merges columns \"label\" \"stat_label\" instead modifying \"label\" column directly. breaking change users manually updated results, example, tbl_regression() table merge tbl_summary() using tbl_merge() function add_stat_label() longer auto-switches location = \"column\" requests \"row\" presence \"continuous2\" variables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-137","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.7","title":"gtsummary 1.3.7","text":"CRAN release: 2021-02-26 changes. Resubmitting resolve CRAN quirk.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-136","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.6","title":"gtsummary 1.3.6","text":"CRAN release: 2021-01-08","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-3-6","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.3.6","text":"Added function add_difference(), adds difference groups, confidence interval p-value. (#617) Added function modify_caption() includes table captions. gt output, requires gt version > 0.2.2 (#701) Added function modify_table_body() allowing users easily make changes gtsummary tables Added function remove_row_type() removing header, reference, missing rows gtsummary tables. (#678) Added selecting function all_stat_cols() selects columns tbl_summary/tbl_svysummary object summary statistics (.e. \"stat_0\", \"stat_1\", \"stat_2\", etc.). New selecting function added all_tests() make easier select variables based test used calculate p-value, e.g. add_p(test = c(age, marker) ~ \"t.test\", test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE)) Added functions modify_column_hide() modify_column_unhide() hide unhide columns .$table_body. Simple wrappers modify_table_header().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-3-6","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.3.6","text":"Previously, tbl_summary(digits=) accepted integer values specifying number decimal places round statistic. argument now accepts integers functions, e.g. digits = age ~ style_sigfig. (#708) add_stat() function now supports tbl_svysummary() objects addition tbl_summary() (#688) add_stat() function can now place statistics label row, level rows categorical variables. (#714) inline_text.tbl_survfit() updated allow users select p-value () columns. (#589)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-3-6","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.3.6","text":"modify_header() updated users may easily access internal data defining headers longer adds call gtsummary .$call_list (#719) default value include= argument add_global_p.tbl_regression() add_global_p.tbl_uvregression() methods made include = everything(), help files methods brought together single file. (#721) Introducing new package dependency {broom.helpers} tidying preparation tbl_regression() tables now performed {broom.helpers} (#636, #607) select helper functions utility functions make possible, cleaned migrated {broom.helpers}. (#648, #680) Importing .generic_selector(), .select_to_varnames(), .formula_list_to_named_list() {broom.helpers}: function makes easy create selecting functions like all_continuous(). internals allow used {broom.helpers} {gtsummary} seamlessly. (#680) Theme element added controlling tidy_plus_plus() arguments. (#692) Variables follow standard naming conventions now parsed correctly presented regression tables. tbl_regression() function now S3 method. new interface allows special handling different model types using S3 methods: tbl_regression.default(), tbl_regression.lmer(), tbl_regression.glmer(), tbl_regression.survreg() tbl_regression(add_estimate_to_reference_rows=) argument added. Also added tbl_uvregression(). (#692) Theme element tbl_regression(add_estimate_to_reference_rows=) added. (#677) Removed \"Statistics presented:\" \"Statistical tests performed:\" prefixes tbl_summary() %>% add_p() footnotes. codebase powering add_p() related methods refactored better performance, organization, customizability. (#622) clarity, help file listing test available within gtsummary pseudo code calculating p-value added (see ?tests) add_p() method now test.args= argument. Use argument pass additional arguments statistical method, e.g. add_p(test = c(age, marker) ~ \"t.test\", test.args = c(age, marker) ~ list(var.equal = TRUE)) Additional tests added: paired t-test, signed rank test, . See ?tests full list. robust unit testing implemented add_p() methods. Added messaging tbl_stack() inform users attributes first table passed take precedent others’. (#699) modfiy_*() functions, users select columns, encountered error. Now, columns selected, instructions printed correctly select columns gtsummary table. Moreover, columns selected, gtsummary object now returned unaltered. (#699) add_glance_source_note() function generalized users may pass glance function. Previously, broom::glance() used option change . (#699) ... arguments added as_gt(). dots subsequently passed gt::gt(...). (#701) Multiple imputation models created {mice}, multinomial regression models created {nnet} now supported tbl_regression() (#645) Updates add_global_p.tbl_regression() allowing variable names spaces special characters (#682) Added digits= argument style_percent() (#690) Users may now choose tbl_regression() columns report theme element. can choose among \"estimate\", \"std.error\", \"statistic\", \"ci\", \"conf.low\", \"conf.high\" \"p.value\" (#637) Allow users include reference value tbl_regression() via theme element Users may change symbol reference row symbol theme element. (#628)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-6","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.6","text":"Bug fix default statistic set using themes \"continuous2\" variables length larger one Bug fix missing/non-missing percentages requested add_n.tbl_summary()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-3-6","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.3.6","text":"default test 2--2 tables expected cell counts updated chi-squared test continuity correction original chi-squared test add_p.tbl_summary() (#721) Experimental function add_p.tbl_survfit(test.args=) addition accepting formula list notation, also accepted single string naming test interpreted everything() ~ \"test_name\". single string longer accepted, users must use formula notation. Removed theme element N_fun previously marked questioning likely removed package.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-135","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.5","title":"gtsummary 1.3.5","text":"CRAN release: 2020-09-29","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-3-5","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.3.5","text":"New summary type continuous2 allows adding labelled statistic rows tables tbl_summary() tbl_svysummary(). can report several lines statistics type. (#620) all_continuous() function now selects summary types continuous continuous2 default. Added all_continuous2() function selecting summary type continuous2 exclusively. Added theme_gtsummary_continuous2() make continuous2 default summary type continuous variables. New function add_glance_source_note() adds statistics returned broom::glance() source note tbl_regression() (#434) Exporting modify_table_header() function, advanced-use function used make modifications .$table_header object update printing instructions gtsummary object. Added two custom tidiers use tbl_regression() tbl_uvregression(). (#635) tidy_standardize() returns standardized coefficients using {effectsize} package tidy_bootstrap() gives bootstrapped parameter estimates, calculated using {parameters} package","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-5","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.5","text":"Bug fix estimate_fun= pvalue_fun= passed tbl_regression() tbl_uvregression() environments bug evaluating LHS formula inputs. complex situations, stored character vector column names properly evaluate (#604) Fixed style_ratio() bug rounding errors near one (#651) Fixed style_sigfig() bug rounding errors near thresholds (#638) Adding footnote stat columns describing statistics presented overall column (#643)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-3-5","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.3.5","text":"Refresh vignettes use recently released functions (#649) Moved nevent column N column add_nevent() called tbl_regression() object (#439) gtsummary themes updates Add theme_gtsummary_mean_sd() theme report mean SD default use t-tests ANOVA add_p() (#654) Added first draft NEJM theme Added mid-point decimal separator Lancet theme","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-134","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.4","title":"gtsummary 1.3.4","text":"CRAN release: 2020-08-27 Added copy tidyselect’s () function allow users use predicate select helpers (#632) Fixed tbl_cross() bug function defaulted 'column' margin = NULL. Now defaults display margins NULL. (#624) Changed default tbl_survfit() missing argument '\\U2014' (em dash) NULL (CRAN issue). Em dash still displayed default tables set later function.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-133","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.3","title":"gtsummary 1.3.3","text":"CRAN release: 2020-08-11","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-3-3","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.3.3","text":"{flextable} graduated Experimental status! Introducing as_flex_table(), replaces as_flextable(). updated function includes improvements default aesthetics tables, improved consistency spanning header rows. Added tbl_svysummary() function summarize complex weighted survey designs. tbl_svysummary now class works add_n(), add_p(), add_q(), add_stat_label(), add_overall(), inline_text(), tbl_merge() tbl_stack() (#460). family tbl_survfit() functions greatly expanded! tbl_survfit.survfit(), tbl_survfit.list(), tbl_survfit.data.frame() added accept single survfit object, list survfit objects, data frame flexible creation univariate survival tables. add_p.tbl_survfit(), add_n.tbl_survfit(), add_nevent.tbl_survfit() added include additional information tbl_survfit() tables. Adding as_hux_table() huxtable 5.0.0 release. Added show_header_names() function assist updating table headers, footnotes, spanning headers. function prints current underlying column names along labels easing process identifying column names needed make updates. (#539) Added language theme, theme_gtsummary_language() translating tables Spanish, French, Portuguese, German, Chinese (Traditional Simplified), Hindi, Marathi, Gujarati, Japanese Swedish (#511) Added style_number() function allows granular control numbers formatted throughout package. style_percent(), style_pvalue(), style_sigfig(), style_ratio() functions updated use style_number() background. implication users can now control every number gtsummary table appears. example, formatting can updated use comma decimal mark also specify big mark using gtsummary themes. (#458)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"user-facing-updates-1-3-3","dir":"Changelog","previous_headings":"","what":"User-facing Updates","title":"gtsummary 1.3.3","text":"Added support competing risk cumulative incidence estimates tbl_survfit() (#64, #448) Updated API set_gtsummary_theme(). Users longer need call set_gtsummary_theme(theme_gtsummary_journal()); rather, call theme_gtsummary_journal(). built-theme now argument set_theme = TRUE. FALSE, theme function invisibly return named list theme elements, theme set. (#522) Users can now specify many decimal places round statistics categorical variables tbl_summary(), e.g. 45 / 100 (45.0%). (#458) Added ‘Lancet’ theme theme_gtsummary_journal() Updated handling arguments accept functions allow users pass anonymous functions using tidyverse shortcut notation, e.g. ~style_pvalue(.x, digits = 2). header tbl_stack(group_header=) column now integrated typical gtsummary framework, meaning standard functions can executed , e.g. modify_header() non-gt output. Added type= argument add_global_p(), added include= keep= arguments add_global_p.tbl_uvregression() (#554)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"internal-updates-1-3-3","dir":"Changelog","previous_headings":"","what":"Internal Updates","title":"gtsummary 1.3.3","text":"Updated add_n() internals efficient without recalculating statistics previously saved tbl_summary() {survival} package moved Imports Suggests add_overall() function now method function, add_overall.tbl_summary add_overall.tbl_svysummary added (#460). Updated variable labels age marker trial dataset. Removed large *.gif files package reduce build size (#485)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-3","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.3","text":"Fixed bug source note made smaller font size compact theme table printed {flextable} (#584) Bug fix tbl_summary() data frame contained ordered factor column (#567) Bug fix categorical summary statistics requested continuous variables tbl_summary() tbl_svysummary() (#528) Bug fix named list {gtsummary} objects passed tbl_merge(x=) (#541) Bug fix tbl_uvregression() adjustment variables included formula = \"{y} ~ {x} + age\". adjustment variables printed resulting table. (#555)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-3-3","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.3.3","text":"lifecycle::deprecate_warn() upgraded lifecycle::deprecate_stop() <= v1.2.0 (released Aug 2019) Removing as_flextable() replacing as_flex_table() due name conflict flextable::as_flextable (#462)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-132","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.2","title":"gtsummary 1.3.2","text":"CRAN release: 2020-06-14 Now returning columns broom::tidy() .$table_body() (#516) tbl_stack() now accepts named list gtsummary tables using group_header= argument (#524) add_p.tbl_summary() bug fix Wilcoxon rank-sum p-value calculation introduced last release (#525) Delaying release as_huxtable() next {huxtable} release.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-131","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.1","title":"gtsummary 1.3.1","text":"CRAN release: 2020-06-02","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-3-1","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.3.1","text":"Introducing themes {gtsummary}. Use function set_gtsummary_theme() set new themes, review themes vignette details setting creating personalized themes. (#424) New functions modify_footnote() modify_spanning_header() give users control table footnotes spanning headers. (#464) Introducing as_huxtable()! function converts gtsummary objects {huxtable} objects. {huxtable} supports indentation, footnotes, spanning headers Word, HTML, PDF output. (#469) New function add_stat()! Add new column statistic tbl_summary() table (#495)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"user-facing-updates-1-3-1","dir":"Changelog","previous_headings":"","what":"User-facing Updates","title":"gtsummary 1.3.1","text":"following columns tbl_summary() now available print continuous categorical variables: total number observations {N_obs}, number missing observations {N_miss}, number non-missing observations {N_nomiss}, proportion missing observations {p_miss}, proportion non-missing observations {p_nomiss}. (#473) Improved appearance default as_flextable() output (#499) Added tbl_cross(margin=) argument control margins shown output table. (#444) missing values now included calculation p-values tbl_cross(). Messaging statistical methods used added add_global_p(), add_q(), combine_terms(). (#471) Added include= argument tbl_summary(). preferred syntax p-values correlated data now tbl_summary(..., include = -group_var) %>% add_p(group = group_var). group variable now longer removed table summary. (#477) add_stat_label() function updated location= label= arguments change location statistic labels modify text labels. location = \"row\" now default. (#467) tbl_stack() function added group_header= argument groups stacked tables adds horizontal header row . (#468) Updated handling interaction terms tbl_regression(). Interaction terms may now specified show_single_row= label= arguments. (#451, #452)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"internal-updates-1-3-1","dir":"Changelog","previous_headings":"","what":"Internal Updates","title":"gtsummary 1.3.1","text":"Improved error messaging invalid statistics requested tbl_summary(statistic=) (#502) columns as_tibble() now styled converted character. Previously, styling applied columns, relied default printing type underlying data. ok rely default behavior as_kable(), introduction as_flextable() needed style format column character. Potential break code edge cases. (#493) Handling passed custom p-value functions add_p.tbl_summary() improved careful handling environments functions passed. related updates also made: Users may pass custom p-value function quoted string bare. basic functions calculating p-values, t.test() can now passed directly e.g. test = age ~ t.test. now perform check match check functions passed. passed, replace internal version returns p-value assigns test name. user passes custom function, ’s proper form (.e. named list return object) function returns single numeric value, assume p-value ’s added gtsummary table. Updated gtsummary core script, utils-gtsummary_core.R, refer non-base R functions pkg:: prefix, packages copy file don’t need import functions {gtsummary} NAMESPACE. Now just need depend packages. (#454)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-1","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.1","text":"Bug fix inline_text.tbl_summary() categorical variable contained levels empty strings. still issue user tries select empty string, however. Fixed bug variables tbl_cross() defaulted dichotomous instead showing categorical (#506) Bug fix using tbl_summary(=) missing observations = followed add_overall() Bug fix values \">0.9\" incorrectly made bold using bold_p(). (#489) Bug fix as_flextable(). (#482) Added formatting function numeric columns force conversion character. Spanning headers printed alphabetical order! Update preserve ordering.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-130","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.0","title":"gtsummary 1.3.0","text":"CRAN release: 2020-04-17","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-3-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.3.0","text":"Introducing tbl_cross(), add_p.tbl_cross(), inline_text.tbl_cross()! Easily construct cross tabulations two variables. Introducing tbl_survfit() inline_text.tbl_survfit()! eventually replace tbl_survival(), longer encouraged. new functions follow structural guidelines {gtsummary} object can merged stacked {gtsummary} object (#280) Introducing as_flextable()! function converts gtsummary objects {flextable} objects. {flextable} great option using R markdown Microsoft Word output. {flextable} supports indentation, footnotes, spanning headers Word, HTML, PDF output. Introducing as_kable_extra()! function converts gtsummary objects {kableExtra} objects. {kableExtra} supports indentation, footnotes, spanning headers HTML PDF output. (#394)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"user-facing-updates-1-3-0","dir":"Changelog","previous_headings":"","what":"User-facing Updates","title":"gtsummary 1.3.0","text":"Updated default print engine {gtsummary} objects. {gt} default printer R console R markdown documents HTML output. PDF, RTF, Word output default using {kable} note referring users new vignette explaining {gt} used. (#395, #396) Updated add_p() custom p-value description require double escape characters quotation marks (#361) Created structure enumerated list unit tests vetted model must pass, added tests (#383)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"internal-updates-1-3-0","dir":"Changelog","previous_headings":"","what":"Internal Updates","title":"gtsummary 1.3.0","text":"gtsummary object associated .$table_header. code needed print table either gt kable previously mix information stored table_header, code manually added gt_calls kable_calls object. Now, information needed print table stored table_header. advantage updates printing now require update table_header , longer need update tibble, kable gt calls. (#412, #414) {gt} package now released CRAN, ’ve updated depend CRAN version instead version GitHub. also resulted significant updates throughout documentation code. example, longer provide instructions installing {gt}, include internal checks {gt} installed. (#420) Several functions made general, may now applied {gtsummary}-like object. Functions updated add_q(), bold_p(), sort_p(), tbl_merge(), tbl_stack(), bold_labels(), bold_levels(), italicize_labels(), italicize_levels(). (#434, #429, #373) tbl_regression() previously printed estimate, confidence interval, p-value models. models don’t associated methods calculating p-value confidence intervals. update, now print p-value tidy() returns \"p.value\" column. Similarly, confidence interval printed tidy() returns \"conf.low\" \"conf.high\" columns. (#391, #404)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.0","text":"Bug fix data frame passed tbl_summary() single column (#389) tbl_summary() passing ordered factor = argument longer causes error. (#453)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-126","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.6","title":"gtsummary 1.2.6","text":"CRAN release: 2020-02-13 Bug fix random effects regression model coefficients exponentiated requested. Using broom.mixed::tidy() rather broom::tidy() resolved issue.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-125","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.5","title":"gtsummary 1.2.5","text":"CRAN release: 2020-02-11","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"documentation-1-2-5","dir":"Changelog","previous_headings":"","what":"Documentation","title":"gtsummary 1.2.5","text":"Updated documentation README improve readability, added cross-linking across pages, added search terms help users find package, added gif demonstrations (#340) README images now build differently website vs GitHub markdown accommodate different output formats","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-2-5","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"gtsummary 1.2.5","text":"Removed deprecated fmt*_() cols_label_summary() functions (#365) Functions tbl_summary_() add_p_() deprecated = group= arguments now accept strings (#250)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"syntax-1-2-5","dir":"Changelog","previous_headings":"","what":"Syntax","title":"gtsummary 1.2.5","text":"Package-wide update allowing arguments accept variable names accept bare/symbol inputs, character inputs, stored character inputs, tidyselect helpers. passing single variable, vars() function wrapper longer required. (#250) Updated tbl_uvregression() allow flexible tidyselect inputs improved error messaging arguments x y (#249) input updates #250, exclude= argument appearing add_p(), tbl_regression(), tbl_uvregression(), as_gt(), as_kable(), as_tibble() redundant. exclude= argument now deprecated. Use include= instead, tidyselect syntax. (#331) Functions all_categorical(), all_dichotomous(), all_continuous() may now used tbl_summary() argument type= (#256)","code":"tbl_summary(trial, label = age ~ \"NEW LABEL\")) tbl_summary(trial, label = \"age\" ~ \"NEW LABEL\")) tbl_summary(trial, label = c(\"age\", \"trt\") ~ \"NEW LABEL\")) tbl_summary(trial, label = c(age, trt) ~ \"NEW LABEL\")) tbl_summary(trial, label = vars(age, trt) ~ \"NEW LABEL\")) tbl_summary(trial, label = vars(everything(), -age, -trt) ~ \"NEW LABEL\")) age_column = \"age\" tbl_summary(trial, label = age_column ~ \"NEW LABEL\")) tbl_summary(trial, label = vars(age_column) ~ \"NEW LABEL\") purrr::map(c(\"trt\", \"grade\"), ~tbl_summary(trial, by = .x))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"user-facing-improvements-1-2-5","dir":"Changelog","previous_headings":"","what":"User-facing improvements","title":"gtsummary 1.2.5","text":"New pattern= argument inline_text.tbl_summary(). Previously, grab entire cell tbl_summary() inline_text(), now can get single statistic reported (#254) Improved messaging users use knitr::kable() print gtsummary tables, users yet installed {gt} package (#347) New function combine_terms() allows users combine multiple independent variables regression model single line tbl_regression(). single line report regression coefficients, rather single p-value anova() function. (#310) regression modeling functions tbl_regression() tbl_uvregression(), users presented informative error message tidier fails (e.g. broom::tidy()) alerting location error may address issue (#337, #338) release gtsummary, now can make reference version gt release coincides . commit SHA gt now saved object called gt_sha, version gt can installed remotes::install_github(\"rstudio/gt\", ref = gt_sha) (#329) Created “style” family functions Improved error messaging tidyselect_to_list() (#300)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-features-and-fixes-1-2-5","dir":"Changelog","previous_headings":"","what":"Other features and fixes","title":"gtsummary 1.2.5","text":"Updated class detection use inherits(), added secondary class \"gtsummary\" objects. allows users create cobbled/custom gtsummary objects utilizing gtsummary print functions (#249) tbl_summary() now summarize columns class difftime (#343) Infrastructure update way styling/formatting functions returned. Styling functions now returned column .$table_header tibble. update simplifies handling styling functions tbl_merge() tbl_stack(). (#298, #299) Bug fix tbl_summary() variables NA (#344) data summary function add_p() now uses probabilities rather counts calculate expected cell counts avoid error working large data sets. (#341) Cubic spline terms now accurately matched variable name/term (#312) Bug fix non-standard evaluation arguments passed method.args= argument tbl_uvregression() (#322) Updates gt package deprecated gt::cells_data() favor gt::cells_body(). Check added as_gt() ensuring version gt gt::cells_body() NAMESPACE Lowered minimum required version R v3.4 (#356) Removed {broom.mixed} dependency {broom} package contained necessary tidiers (#354)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-124","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.4","title":"gtsummary 1.2.4","text":"CRAN release: 2019-12-16 Bug fix as_kable() column header match statistics presented certain levels = variable entirely missing tbl_summary() (#304) Updated trial example data set \"trt\" variable \"Drug \" \"Drug B\" instead \"Placebo\" \"Drug\" Improved messaging users error warning occurs calculating p-value add_p(). Also, p-values longer omitted output warning encountered calculation (#283) Added tidy_fun= argument tbl_regression() tbl_uvregression() allowing users pass tidiers {broom} {broom.mixed} packages (#247)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-123","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.3","title":"gtsummary 1.2.3","text":"CRAN release: 2019-11-12 tbl_uvregression() now accepts x= argument build univariate regression models covariate x remains models built remaining variables outcome (#294) Internal updates way {gt} installed CRAN checks. Bug fix stacking tbl_summary objects calculated p-values.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-122","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.2","title":"gtsummary 1.2.2","text":"CRAN release: 2019-11-10","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-features-1-2-2","dir":"Changelog","previous_headings":"","what":"New Features","title":"gtsummary 1.2.2","text":"tbl_summary objects may stacked merged tbl_stack() tbl_merge() (#230, #255) add_n() function now reports additional statistics: total N, non-missing N, missing N, percentages. missing = argument deprecated favor statistic = argument. (#237) Users may now pass list formulas, named lists, combination (#251) Users can add option script append {gt} calls {gtsummary} object printed: gtsummary.as_gt.addl_cmds Added include = exclude = arguments tbl_uvregression() (#240) Added standard evaluation variants, tbl_summary_() add_p_() (#223) Added as_tibble() function converts {gtsummary} table tibble (#245) New show_single_row argument tbl_regression() tbl_uvregression() allows binary variable printed single row. Previous argument show_yesno now deprecated. (#220)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"documentation-1-2-2","dir":"Changelog","previous_headings":"","what":"Documentation","title":"gtsummary 1.2.2","text":"Added gallery tables possible merging, stacking, modifying {gtsummary} arguments (#258) Added vignette documenting global option can set {gtsummary} (#289) Added {lifecycle} badges mark deprecated experimental functions (#225)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-2-2","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.2.2","text":"= column tbl_summary() now missing variables dropped rather halting error (#279) Bug fix vars() selection first variable listed selected (#259) Bug fix logical variable labels printed NA tbl_regression() (#248) tbl_merge() now interprets tab_spanner = text gt::md() (#253) longer checking outcome variable name consistency tbl_regression()—checking independent variable names (#287) Improved error messaging add_global_p() (#243) Removed gt::cols_merge() function ahead {gt} package PR 355 changes cols_merge() API (#222) Updated API using custom functions calculate p-values add_p(). User now may reference custom function name. (#226) Removed legacy support tidyr version less 1.0.0 (#235)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-121","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.1","title":"gtsummary 1.2.1","text":"CRAN release: 2019-08-20 Vignettes longer install {gt} package (required CRAN check) (#217) Added ability name custom add_p() tests (#213)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-120","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.0","title":"gtsummary 1.2.0","text":"CRAN release: 2019-08-19 Users can pass variable names backticks (#212) group = argument tbl_summary() moved add_p() (#208) Users can now write custom functions calculate p-values add_p() (#194) tbl_summary() = argument accepts bare variable name instead variable name passed string (#193) Added support column, row, cell percentages tbl_summary() (#181) Users can now set default p-value formatting functions, regression coefficient formatting functions, default level confidence intervals, formatting functions tbl_survival() (#120) {gt} package longer required dependency. {gt} installed, tables printed knitr::kable(). as_kable() function added package well. (#180) function as_gt() now include = exclude = arguments Updated function names first version Passing named lists tbl_summary() now defunct. tbl_stack() fix tbl_uvregression objects (#175) Option exclude variables testing using add_p() (#164) Updates {gt} package renamed cells_style() cell_text() (#78)","code":"bold_p() <- tab_style_bold_p() bold_labels() <- tab_style_bold_labels() bold_levels() <- tab_style_bold_levels() italicize_labels() <- tab_style_italicize_labels() italicize_levels() <- tab_style_italicize_levels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-111","dir":"Changelog","previous_headings":"","what":"gtsummary 1.1.1","title":"gtsummary 1.1.1","text":"Modified tbl_merge() accommodate tbl_stack() object (#167) Bug fix incorrect column order tbl_summary() 10+ levels variable (#166)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-110","dir":"Changelog","previous_headings":"","what":"gtsummary 1.1.0","title":"gtsummary 1.1.0","text":"Added {tidyselect} {gtsummary} variable select functions (#146) Added tbl_stack() function (#152) Bug fix dichotomous yes/variables tbl_summary (#158) Changed add_comparison() add_global() add_p() add_global_p() (#143) Added sort_p() function (#105) Allow unobserved values serve level dichotomous variables (#149) Bug fix add_nevent() formula passed glm() string (#148) Added returned call_list functions without previously (#137) Corrected name call list returned tbl_regression() results (#128) tbl_survival(): bug fix upper bound CI able estimated (#134) tbl_survival(): groupname column name changed label_level (#133)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-100","dir":"Changelog","previous_headings":"","what":"gtsummary 1.0.0","title":"gtsummary 1.0.0","text":"First release since major re-factoring. {gt} package now used print engine create tables. function names modified line {gt} function calls, additional functions added. API functions also updated. Review documentation vignettes details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"updated-function-names-1-0-0","dir":"Changelog","previous_headings":"","what":"Updated Function Names","title":"gtsummary 1.0.0","text":"","code":"tbl_summary() <- fmt_table1() tbl_regression() <- fmt_regression() tbl_uvregression() <- fmt_uni_regression() style_pvalue() <- fmt_pvalue() style_percent <- fmt_percent() style_ratio <- fmt_beta()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-0-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.0.0","text":"","code":"tbl_survival() as_gt() tbl_merge() style_sigfig() add_nevent() gtsummary_logo()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-010","dir":"Changelog","previous_headings":"","what":"gtsummary 0.1.0","title":"gtsummary 0.1.0","text":"CRAN release: 2019-05-10 First version package available .","code":""}] +[{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CODE_OF_CONDUCT.html","id":null,"dir":"","previous_headings":"","what":"Contributor Code of Conduct","title":"Contributor Code of Conduct","text":"contributors maintainers project, pledge respect people contribute reporting issues, posting feature requests, updating documentation, submitting pull requests patches, activities. committed making participation project harassment-free experience everyone, regardless level experience, gender, gender identity expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, religion. Examples unacceptable behavior participants include use sexual language imagery, derogatory comments personal attacks, trolling, public private harassment, insults, unprofessional conduct. Project maintainers right responsibility remove, edit, reject comments, commits, code, wiki edits, issues, contributions aligned Code Conduct. Project maintainers follow Code Conduct may removed project team. Instances abusive, harassing, otherwise unacceptable behavior may reported opening issue contacting one project maintainers. Code Conduct adapted Contributor Covenant (https://www.contributor-covenant.org), version 1.0.0, available https://contributor-covenant.org/version/1/0/0/.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":null,"dir":"","previous_headings":"","what":"Contributing to gtsummary","title":"Contributing to gtsummary","text":"outlines propose change gtsummary.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":"fixing-typos","dir":"","previous_headings":"","what":"Fixing typos","title":"Contributing to gtsummary","text":"Small typos grammatical errors documentation may edited directly using GitHub web interface, long changes made source file. YES: edit roxygen comment .R file R/. : edit .Rd file man/.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":"prerequisites","dir":"","previous_headings":"","what":"Prerequisites","title":"Contributing to gtsummary","text":"make substantial pull request, always file issue make sure someone team agrees ’s problem. ’ve found bug, create associated issue illustrate bug minimal reprex.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":"pull-request-process","dir":"","previous_headings":"","what":"Pull request process","title":"Contributing to gtsummary","text":"recommend create Git branch pull request (PR). Look Travis AppVeyor build status making changes. README contain badges continuous integration services used package. New code follow tidyverse style guide. can use styler package apply styles, please don’t restyle code nothing PR. use roxygen2, Markdown syntax, documentation. use testthat. Contributions test cases included easier accept. user-facing changes, add bullet top NEWS.md current development version header describing changes made followed GitHub username, links relevant issue(s)/PR(s).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/CONTRIBUTING.html","id":"code-of-conduct","dir":"","previous_headings":"","what":"Code of Conduct","title":"Contributing to gtsummary","text":"Please note gtsummary project released Contributor Code Conduct. contributing project agree abide terms.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"MIT License","title":"MIT License","text":"Copyright (c) 2023 gts2 authors Permission hereby granted, free charge, person obtaining copy software associated documentation files (“Software”), deal Software without restriction, including without limitation rights use, copy, modify, merge, publish, distribute, sublicense, /sell copies Software, permit persons Software furnished , subject following conditions: copyright notice permission notice shall included copies substantial portions Software. SOFTWARE PROVIDED “”, WITHOUT WARRANTY KIND, EXPRESS IMPLIED, INCLUDING LIMITED WARRANTIES MERCHANTABILITY, FITNESS PARTICULAR PURPOSE NONINFRINGEMENT. EVENT SHALL AUTHORS COPYRIGHT HOLDERS LIABLE CLAIM, DAMAGES LIABILITY, WHETHER ACTION CONTRACT, TORT OTHERWISE, ARISING , CONNECTION SOFTWARE USE DEALINGS SOFTWARE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/SUPPORT.html","id":null,"dir":"","previous_headings":"","what":"Getting help with gtsummary","title":"Getting help with gtsummary","text":"Thanks using gtsummary. filing issue, places explore pieces put together make process smooth possible. Start making minimal reproducible example using reprex package. haven’t heard used reprex , ’re treat! Seriously, reprex make R-question-asking endeavors easier (pretty insane ROI five ten minutes ’ll take learn ’s ). opening new issue, sure search issues pull requests make sure bug hasn’t reported /already fixed development version. default, search pre-populated :issue :open. can edit qualifiers (e.g. :pr, :closed) needed. example, ’d simply remove :open search issues repo, open closed. Thanks help!","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gallery.html","id":"data-summary-tables","dir":"Articles","previous_headings":"Frequently Asked Questions","what":"Data Summary Tables","title":"FAQ + Gallery","text":"Headers, Labels Formatting modify column headers table? change value levels? added spanning header row table? change variable labels? italicize bold labels table? italicize bold levels table? reduce font size cell padding table? Adding Modifying Statistics add number observations summary table? show additional summary statistics new row? include column missing values grouping variable? add column confidence around mean? add column difference groups? summarize continuous variable one, two () categorical variables? stratify summary table one variable? change p-values format? add p-value group compared single reference group? add correction multiple testing? combine summary table regression table? Statistical Tests paired t-test McNemar’s test?","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gallery.html","id":"regression-tables","dir":"Articles","previous_headings":"Frequently Asked Questions","what":"Regression Tables","title":"FAQ + Gallery","text":"Headers, Labels Formatting change text footnote? add significance stars low p-values? reduce font size cell padding table? Creating Combining Tables combine results two related regression models one table? combine regression table summary table? create regression table multiple models covariate(s) different outcomes? Adding Modifying Statistics add total event numbers regression table? add event numbers level categorical covariate? format Wald confidence interval?","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gallery.html","id":"summary-tables","dir":"Articles","previous_headings":"","what":"Summary Tables","title":"FAQ + Gallery","text":"Add spanning header group columns increased clarity, modify column headers. Using bold_labels() formats labels bold, labels can also italicized using italicize_labels(), combined format bold italics. Show continuous summary statistics multiple lines. Levels italicized using italicize_levels() function, bold_levels() function can used instead create bold text, functions can used together get text bold italics. Modify function formats p-values, change variable labels, updating tumor response header, add correction multiple testing. Include missing tumor response column using forcats::fct_na_value_to_level(). Report treatment differences two groups. often needed randomized trials. example, report difference tumor response marker level two chemotherapy treatments. Paired t-test McNemar’s test. data expected long format 2 rows per participant. Include p-values comparing groups single reference group. Add 95% confidence interval around mean additional column ’s often needed summarize continuous variable one, two, categorical variables. example shows table summarizing continuous variable two categorical variables. summarize two categorical variables, use tbl_continuous conjunction tbl_strata (see example tbl_strata ). Build summary table stratified one variable.","code":"trial |> tbl_summary( by = trt, include = c(age, grade), missing = \"no\", statistic = all_continuous() ~ \"{median} ({p25}, {p75})\" ) |> modify_header(all_stat_cols() ~ \"**{level}** \\nN = {n} ({style_percent(p)}%)\") |> add_n() |> bold_labels() |> modify_spanning_header(all_stat_cols() ~ \"**Chemotherapy Treatment**\") trial |> tbl_summary( by = trt, include = c(age, marker), type = all_continuous() ~ \"continuous2\", statistic = all_continuous() ~ c(\"{N_nonmiss}\", \"{mean} ({sd})\", \"{median} ({p25}, {p75})\", \"{min}, {max}\"), missing = \"no\" ) |> italicize_levels() trial |> mutate(response = factor(response, labels = c(\"No Tumor Response\", \"Tumor Responded\"))) |> tbl_summary( by = response, include = c(age, grade), missing = \"no\", label = list(age ~ \"Patient Age\", grade ~ \"Tumor Grade\") ) |> add_p(pvalue_fun = label_style_pvalue(digits = 2)) |> add_q() trial |> mutate( response = factor(response, labels = c(\"No Tumor Response\", \"Tumor Responded\")) |> forcats::fct_na_value_to_level(level = \"Missing Response Status\") ) |> tbl_summary( by = response, include = c(age, grade), label = list(age ~ \"Patient Age\", grade ~ \"Tumor Grade\") ) trial |> tbl_summary( by = trt, include = c(response, marker), statistic = list( all_continuous() ~ \"{mean} ({sd})\", all_categorical() ~ \"{p}%\" ), missing = \"no\" ) |> add_difference() |> add_n() |> modify_header(all_stat_cols() ~ \"**{level}**\") # imagine that each patient received Drug A and Drug B (adding ID showing their paired measurements) trial_paired <- trial |> select(trt, marker, response) |> mutate(.by = trt, id = dplyr::row_number()) # you must first delete incomplete pairs from the data, then you can build the table trial_paired |> # delete missing values tidyr::drop_na() |> # keep IDs with both measurements dplyr::filter(.by = id, dplyr::n() == 2) |> # summarize data tbl_summary(by = trt, include = -id) |> add_p( test = list(marker ~ \"paired.t.test\", response ~ \"mcnemar.test\"), group = id ) # table summarizing data with no p-values small_trial <- trial |> select(grade, age, response) t0 <- small_trial |> tbl_summary(by = grade, missing = \"no\") |> modify_header(all_stat_cols() ~ \"**{level}**\") # table comparing grade I and II t1 <- small_trial |> dplyr::filter(grade %in% c(\"I\", \"II\")) |> tbl_summary(by = grade, missing = \"no\") |> add_p() |> modify_header(p.value ~ \"**I vs. II**\") |> # hide summary stat columns modify_column_hide(all_stat_cols()) # table comparing grade I and II t2 <- small_trial |> dplyr::filter(grade %in% c(\"I\", \"III\")) |> tbl_summary(by = grade, missing = \"no\") |> add_p() |> modify_header(p.value = \"**I vs. III**\") |> # hide summary stat columns modify_column_hide(all_stat_cols()) # merging the 3 tables together, and adding additional gt formatting tbl_merge(list(t0, t1, t2)) |> modify_spanning_header( all_stat_cols() ~ \"**Tumor Grade**\", starts_with(\"p.value\") ~ \"**p-values**\" ) trial |> tbl_summary( include = c(age, marker), statistic = all_continuous() ~ \"{mean} ({sd})\", missing = \"no\" ) |> modify_header(stat_0 = \"**Mean (SD)**\") |> remove_footnote_header(stat_0) |> add_ci() trial |> tbl_continuous(variable = marker, by = trt, include = grade) |> modify_spanning_header(all_stat_cols() ~ \"**Treatment Assignment**\") trial |> select(trt, grade, age, stage) |> mutate(grade = paste(\"Grade\", grade)) |> tbl_strata( strata = grade, ~ .x |> tbl_summary(by = trt, missing = \"no\") |> modify_header(all_stat_cols() ~ \"**{level}**\") )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gallery.html","id":"regression-tables-1","dir":"Articles","previous_headings":"","what":"Regression Tables","title":"FAQ + Gallery","text":"Include number observations number events univariate regression table. Include two related models side--side descriptive statistics. also use compact table theme reduces cell padding font size. Include number events level categorical predictor. Regression model covariate remains , outcome changes. Implement custom tidier report Wald confidence intervals. Wald confidence intervals calculated using confint.default(). Use significance stars estimates low p-values.","code":"trial |> tbl_uvregression( method = glm, y = response, include = c(age, grade), method.args = list(family = binomial), exponentiate = TRUE ) |> add_nevent() gt_r1 <- glm(response ~ trt + grade, trial, family = binomial) |> tbl_regression(exponentiate = TRUE) gt_r2 <- survival::coxph(survival::Surv(ttdeath, death) ~ trt + grade, trial) |> tbl_regression(exponentiate = TRUE) gt_t1 <- trial |> tbl_summary(include = c(trt, grade), missing = \"no\") |> add_n() |> modify_header(stat_0 = \"**n (%)**\") |> remove_footnote_header(stat_0) theme_gtsummary_compact() #> Setting theme \"Compact\" tbl_merge( list(gt_t1, gt_r1, gt_r2), tab_spanner = c(NA_character_, \"**Tumor Response**\", \"**Time to Death**\") ) trial |> tbl_uvregression( method = survival::coxph, y = survival::Surv(ttdeath, death), include = c(stage, grade), exponentiate = TRUE, hide_n = TRUE ) |> add_nevent(location = \"level\") trial |> tbl_uvregression( method = lm, x = trt, show_single_row = \"trt\", hide_n = TRUE, include = c(age, marker) ) |> modify_header(label = \"**Model Outcome**\", estimate = \"**Treatment Coef.**\") |> modify_footnote_header(\"Values larger than 0 indicate larger values in the Drug B group.\", columns = estimate) my_tidy <- function(x, exponentiate = FALSE, conf.level = 0.95, ...) { dplyr::bind_cols( broom::tidy(x, exponentiate = exponentiate, conf.int = FALSE), # calculate the confidence intervals, and save them in a tibble dplyr::case_when( exponentiate ~ exp(confint.default(x)), .default = confint.default(x) ) |> dplyr::as_tibble(.name_repair = \"minimal\") |> rlang::set_names(c(\"conf.low\", \"conf.high\")) ) } lm(age ~ grade + marker, trial) |> tbl_regression(tidy_fun = my_tidy) trial |> tbl_uvregression( method = survival::coxph, y = survival::Surv(ttdeath, death), include = c(stage, grade), exponentiate = TRUE, ) |> add_significance_stars()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"Definition of a gtsummary Object","text":"Every {gtsummary} table characteristics common among tables created package. , review characteristics, provide instructions construct {gtsummary} object.","code":"library(gtsummary) tbl_regression_ex <- lm(age ~ grade + marker, trial) |> tbl_regression() |> bold_p(t = 0.5) tbl_summary_ex <- trial |> tbl_summary(by = trt, include = c(trt, age, grade, response))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"structure-of-a-gtsummary-object","dir":"Articles","previous_headings":"","what":"Structure of a {gtsummary} object","title":"Definition of a gtsummary Object","text":"Every {gtsummary} object list comprising , minimum, elements:","code":".$table_body .$table_styling"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"table_body","dir":"Articles","previous_headings":"Structure of a {gtsummary} object","what":"table_body","title":"Definition of a gtsummary Object","text":".$table_body object data frame ultimately printed output. table must include columns \"label\", \"row_type\", \"variable\". \"label\" column printed, two hidden final output.","code":"tbl_summary_ex$table_body #> # A tibble: 8 × 7 #> variable var_type row_type var_label label stat_1 stat_2 #> #> 1 age continuous label Age Age 46 (37, 60) 48 (3… #> 2 age continuous missing Age Unknown 7 4 #> 3 grade categorical label Grade Grade NA NA #> 4 grade categorical level Grade I 35 (36%) 33 (3… #> 5 grade categorical level Grade II 32 (33%) 36 (3… #> 6 grade categorical level Grade III 31 (32%) 33 (3… #> 7 response dichotomous label Tumor Response Tumor Response 28 (29%) 33 (3… #> 8 response dichotomous missing Tumor Response Unknown 3 4"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"table_styling","dir":"Articles","previous_headings":"Structure of a {gtsummary} object","what":"table_styling","title":"Definition of a gtsummary Object","text":".$table_styling object list data frames containing information .$table_body printed, formatted, styled. list contains following data frames header, footnote_header, footnote_body, abbreviation, source_note, fmt_fun, text_format, fmt_missing, cols_merge following objects caption horizontal_line_above. header header table following columns one row per column found .$table_body. table contains styling information applies entire column columns headers. footnote_header {gtsummary} table may contain footnotes column headers. Updates/changes footnote appended bottom tibble. footnote_body {gtsummary} table may include footnotes body table. Updates/changes footnote appended bottom tibble. abbreviation Abbreviations added one time, time table rendering, coalesced single source note. source_note tibble source notes include. source note assigned ID based order added table. Source notes added one time present much like footnotes, linked header cell table. fmt_fun Numeric columns/rows styled functions stored fmt_fun. Updates/changes styling functions appended bottom tibble. text_format Columns/rows styled bold, italic, indenting stored text_format. Updates/changes styling functions appended bottom tibble. fmt_missing default, NA values shown blanks. Missing values columns/rows replaced symbol. example, reference rows tbl_regression() shown em-dash. Updates/changes styling functions appended bottom tibble. cols_merge object experimental may change future. tibble gives instructions merging columns single column. implementation as_gt() updated gt::cols_label() gains rows= argument. caption String made table caption. attribute \"text_interpret\" either c(\"md\", \"html\"). horizontal_line_above Expression identifying row horizontal line placed table. Example tbl_regression()","code":"tbl_regression_ex$table_styling #> $header #> # A tibble: 24 × 8 #> column hide align interpret_label label interpret_spanning_h…¹ #> #> 1 variable TRUE center gt::md varia… gt::md #> 2 var_label TRUE center gt::md var_l… gt::md #> 3 var_type TRUE center gt::md var_t… gt::md #> 4 reference_row TRUE center gt::md refer… gt::md #> 5 row_type TRUE center gt::md row_t… gt::md #> 6 header_row TRUE center gt::md heade… gt::md #> 7 N_obs TRUE center gt::md N_obs gt::md #> 8 N TRUE center gt::md **N** gt::md #> 9 coefficients_type TRUE center gt::md coeff… gt::md #> 10 coefficients_label TRUE center gt::md coeff… gt::md #> # ℹ 14 more rows #> # ℹ abbreviated name: ¹​interpret_spanning_header #> # ℹ 2 more variables: spanning_header , modify_stat_N #> #> $footnote_header #> # A tibble: 0 × 5 #> # ℹ 5 variables: column , footnote , text_interpret , #> # replace , remove #> #> $footnote_body #> # A tibble: 0 × 6 #> # ℹ 6 variables: column , rows , footnote , #> # text_interpret , replace , remove #> #> $abbreviation #> # A tibble: 2 × 3 #> column abbreviation text_interpret #> #> 1 conf.low CI = Confidence Interval gt::md #> 2 std.error SE = Standard Error gt::md #> #> $source_note #> # A tibble: 0 × 4 #> # ℹ 4 variables: id , source_note , text_interpret , #> # remove #> #> $text_format #> # A tibble: 1 × 4 #> column rows format_type undo_text_format #> #> 1 p.value bold FALSE #> #> $indent #> # A tibble: 2 × 3 #> column rows n_spaces #> #> 1 label 0 #> 2 label 4 #> #> $fmt_missing #> # A tibble: 4 × 3 #> column rows symbol #> #> 1 estimate — #> 2 conf.low — #> 3 std.error — #> 4 statistic — #> #> $fmt_fun #> # A tibble: 10 × 3 #> column rows fmt_fun #> #> 1 estimate #> 2 N #> 3 N_obs #> 4 n_obs #> 5 conf.low #> 6 conf.high #> 7 p.value #> 8 std.error #> 9 statistic #> 10 var_nlevels #> #> $cols_merge #> # A tibble: 1 × 3 #> column rows pattern #> #> 1 conf.low {conf.low}, {conf.high}"},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"table_body-1","dir":"Articles","previous_headings":"Constructing a {gtsummary} object","what":"table_body","title":"Definition of a gtsummary Object","text":"constructing {gtsummary} object, author begin .$table_body object. Recall .$table_body data frame must include columns \"label\", \"row_type\", \"variable\". columns, \"label\" column printed final results. \"row_type\" column typically control whether label column indented. \"variable\" column often used inline_text() family functions, merging {gtsummary} tables tbl_merge(). columns .$table_body created user likely printed output. Formatting printing instructions columns stored .$table_styling.","code":"tbl_regression_ex %>% getElement(\"table_body\") %>% select(variable, row_type, label) #> # A tibble: 5 × 3 #> variable row_type label #> #> 1 grade label Grade #> 2 grade level I #> 3 grade level II #> 4 grade level III #> 5 marker label Marker Level (ng/mL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"table_styling-1","dir":"Articles","previous_headings":"Constructing a {gtsummary} object","what":"table_styling","title":"Definition of a gtsummary Object","text":"internal {gtsummary} functions assist constructing modifying .$table_header data frame. .create_gtsummary_object(table_body) user creates table_body, pass function skeleton gtsummary object created returned (including full table_styling list tables). .update_table_styling() columns added removed table_body, run function update .$table_styling include remove styling instructions columns. FYI default styling new column hide . modify_table_styling() exported function modifies printing instructions single column groups columns. modify_table_body() exported function helps users make changes .$table_body. function runs .update_table_styling() internally maintain internal validity printing instructions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"printing-a-gtsummary-object","dir":"Articles","previous_headings":"","what":"Printing a {gtsummary} object","title":"Definition of a gtsummary Object","text":"{gtsummary} objects printed print.gtsummary(). {gtsummary} object printed, converted {gt} object using as_gt(). function takes {gtsummary} object input, uses information .$table_styling construct list {gt} calls executed .$table_body. {gtsummary} object converted {gt}, printed {gt} object. cases, package defaults printing engines, flextable (as_flex_table()), huxtable (as_hux_table()), kableExtra (as_kable_extra()), kable (as_kable()). default print engine set theme element \"pkgwide-str:print_engine\" actual print function slightly involved, basically :","code":"print.gtsummary <- function(x) { get_theme_element(\"pkgwide-str:print_engine\") %>% switch( \"gt\" = as_gt(x), \"flextable\" = as_flex_table(x), \"huxtable\" = as_hux_table(x), \"kable_extra\" = as_kable_extra(x), \"kable\" = as_kable(x) ) %>% print() }"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/gtsummary_definition.html","id":"the--cards-object","dir":"Articles","previous_headings":"","what":"The .$cards object","title":"Definition of a gtsummary Object","text":"gtsummary function called requires new statistics, new calculations stored tibble. tibbles often calculated functions {cards} {cardx} packages. structured tibbles store labels statistics, functions format , . See {cards} package documentation details.","code":"tbl_summary_ex$cards[[\"tbl_summary\"]] #> {cards} data frame: 76 x 12 #> group1 group1_level variable variable_level stat_name stat_label stat #> 1 trt Drug A grade I n n 35 #> 2 trt Drug A grade I N N 98 #> 3 trt Drug A grade I p % 0.357 #> 4 trt Drug B grade I n n 33 #> 5 trt Drug B grade I N N 102 #> 6 trt Drug B grade I p % 0.324 #> 7 trt Drug A grade II n n 32 #> 8 trt Drug A grade II N N 98 #> 9 trt Drug A grade II p % 0.327 #> 10 trt Drug B grade II n n 36 #> ℹ 66 more rows #> ℹ Use `print(n = ...)` to see more rows #> ℹ 5 more variables: context, fmt_fn, warning, error, gts_column"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"inline_text() tutorial","text":"Reproducible reports important part good practices. often need report results table text R markdown report. Inline reporting made simple inline_text(). inline_text() function reports statistics {gtsummary} tables inline R markdown report.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"inline_text() tutorial","text":"going tutorial, install load {gtsummary}.","code":"# install.packages(\"gtsummary\") library(gtsummary)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"example-data-set","dir":"Articles","previous_headings":"","what":"Example data set","title":"inline_text() tutorial","text":"’ll using trial data set throughout example. set contains data 200 patients received one two types chemotherapy (Drug Drug B). outcomes tumor response death. brevity tutorial, let’s keep subset variables trial data set.","code":"trial2 <- trial %>% select(trt, marker, stage)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"inline_text_tbl_summary","dir":"Articles","previous_headings":"","what":"Inline results from tbl_summary()","title":"inline_text() tutorial","text":"First create basic summary table using tbl_summary() (review tbl_summary() vignette detailed overview function needed). report median (IQR) marker levels group, use following commands inline. median (IQR) marker level Drug Drug B groups `r inline_text(tab1, variable = marker, column = \"Drug \")` `r inline_text(tab1, variable = marker, column = \"Drug B\")`, respectively. ’s line appear report. median (IQR) marker level Drug Drug B groups 0.84 (0.23, 1.60) 0.52 (0.18, 1.21), respectively. display statistic categorical variable, include level argument. `r inline_text(tab1, variable = stage, level = \"T1\", column = \"Drug B\")` resolves “25 (25%)”","code":"tab1 <- tbl_summary(trial2, by = trt) tab1"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/inline_text.html","id":"inline_text_tbl_regression","dir":"Articles","previous_headings":"","what":"Inline results from tbl_regression()","title":"inline_text() tutorial","text":"Similar syntax used report results tbl_regression() tbl_uvregression() tables. Refer tbl_regression() vignette need detailed guidance using functions. Let’s first create regression model. Now summarize results tbl_regression(); exponentiate get odds ratios. report result age, use following commands inline. `r inline_text(tbl_m1, variable = age)` ’s line appear report. 1.02 (95% CI 1.00, 1.04; p=0.091) reasonable ’ll need modify text. , use pattern argument. pattern argument syntax follows glue::glue() format referenced R objects inserted curly brackets. default pattern = \"{estimate} ({conf.level*100}% CI {conf.low}, {conf.high}; {p.value})\". access following fields within pattern argument. Age significantly associated tumor response `r inline_text(tbl_m1, variable = age, pattern = \"({estimate}; 95% CI {conf.low}, {conf.high}; {p.value})\")`. Age significantly associated tumor response (1.02; 95% CI 1.00, 1.04; p=0.091). ’re printing results categorical variable, include level argument, e.g. inline_text(tbl_m1, variable = stage, level = \"T3\") resolves “0.94 (95% CI 0.39, 2.28; p=0.9)”. inline_text function arguments rounding p-value (pvalue_fun) coefficients confidence interval (estimate_fun). default rounding performed table, can modified reporting inline. details inline code, review RStudio documentation page.","code":"# build logistic regression model m1 <- glm(response ~ age + stage, trial, family = binomial(link = \"logit\")) tbl_m1 <- tbl_regression(m1, exponentiate = TRUE) tbl_m1"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"output-types","dir":"Articles","previous_headings":"","what":"Output Types","title":"gtsummary + Quarto/Rmarkdown","text":"’s summary various Quarto R Markdown output types print engines support . {gtsummary} table can converted one types table . example, code prints {gtsummary} table {flextable} table, instead default {gt} table.","code":"tbl_summary(trial) %>% as_flex_table()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"example-r-markdown-report","dir":"Articles","previous_headings":"","what":"Example R Markdown Report","title":"gtsummary + Quarto/Rmarkdown","text":"example R markdown report using {gtsummary} included package. open example file, run following command R console.","code":"library(gtsummary) system.file(package = \"gtsummary\") %>% file.path(\"rmarkdown_example/gtsummary_rmarkdown_html.Rmd\") %>% file.edit()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"latex","dir":"Articles","previous_headings":"","what":"LaTeX","title":"gtsummary + Quarto/Rmarkdown","text":"print {gtsummary} tables using LaTeX, utilize one supporting print engines.","code":"# build gtsummary table tbl <- tbl_summary(trial) # using the {gt} package as_gt(tbl) %>% gt::as_latex() # using the {huxtable} package as_hux_table(tbl) %>% huxtable::to_latex() # using the {kableExtra} package as_kable_extra(tbl, format = \"latex\") # using the knitr::kable function as_kable(tbl, format = \"latex\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"images","dir":"Articles","previous_headings":"","what":"Images","title":"gtsummary + Quarto/Rmarkdown","text":"Use {gt} package’s gt::gtsave() function save images {gtsummary} tables.","code":"tbl_summary(trial) |> # build gtsummary table as_gt() |> # convert to gt table gt::gtsave( # save table as image filename = \"my_table_image.png\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/rmarkdown.html","id":"tips","dir":"Articles","previous_headings":"","what":"Tips","title":"gtsummary + Quarto/Rmarkdown","text":"printing {gt} {gtsummary} tables loop, use print() results = 'asis' R markdown chunk. print(tbl) work , try either knitr::knit_print(tbl) cat(knitr::knit_print(tbl)). Icons icons8","code":"```{r loop_print, results = 'asis'} for (i in 1) { tbl <- tbl_summary(trial) # build gtsummary table print(tbl) # print table } ```"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/shiny.html","id":"shiny-example","dir":"Articles","previous_headings":"","what":"Shiny Example","title":"gtsummary + Shiny","text":"example Shiny app using gtsummary package provide dynamic patient characteristic summaries. Shiny app run free server usage, see instructions running app locally machine.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/shiny.html","id":"shiny-code","dir":"Articles","previous_headings":"","what":"Shiny Code","title":"gtsummary + Shiny","text":"run Shiny app locally machine, save script app.R R Project, open RStudio, run application.","code":"library(gtsummary) library(shiny) library(gt) # create the Shiny app ui <- fluidPage( # Inputs: Select Age Range sidebarPanel( sliderInput( inputId = \"age_range\", label = \"Age Range\", min = 5, max = 85, value = c(5, 85), step = 5 ) ), # place summary table on main page gt_output(outputId = \"my_gt_table\") ) server <- function(input, output, session) { output$my_gt_table <- render_gt( trial %>% # filter out patients outside of age range dplyr::filter( dplyr::between(age, input$age_range[1], input$age_range[2]) ) %>% # build a gtsummary table tbl_summary( by = trt, type = age ~ \"continuous\", include = c(age, grade, response), missing = \"no\" ) %>% add_stat_label() %>% add_n() %>% # CONVERT TO A {gt} TABLE! VERY IMPORTANT STEP! as_gt() %>% tab_header(md(\"**Table 1. Patient Characteristics**\")) ) } # Run the application shinyApp(ui = ui, server = server)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"tbl_regression() tutorial","text":"tbl_regression() function takes regression model object R returns formatted table regression model results publication-ready. simple way summarize present analysis results using R! Like tbl_summary(), tbl_regression() creates highly customizable analytic tables sensible defaults. vignette walk reader tbl_regression() function, various functions available modify make additions existing formatted regression table. Behind scenes: tbl_regression() uses broom::tidy() perform initial model formatting, can accommodate many different model types (e.g. lm(), glm(), survival::coxph(), survival::survreg() others supported models known work {gtsummary}). also possible specify function tidy model results needed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"tbl_regression() tutorial","text":"going tutorial, install load {gtsummary}.","code":"# install.packages(\"gtsummary\") library(gtsummary)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"example-data-set","dir":"Articles","previous_headings":"","what":"Example data set","title":"tbl_regression() tutorial","text":"vignette ’ll using trial data set included {gtsummary} package. data set contains information 200 patients received one two types chemotherapy (Drug Drug B). outcomes tumor response death. variable data frame assigned attribute label (.e. attr(trial$trt, \"label\") == \"Chemotherapy Treatment\") labelled package, highly recommend using. labels displayed {gtsummary} output table default. Using {gtsummary} data frame without labels simply print variable names, option add labels later.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"basic-usage","dir":"Articles","previous_headings":"","what":"Basic Usage","title":"tbl_regression() tutorial","text":"default output tbl_regression() meant publication ready. Let’s start creating logistic regression model predict tumor response using variables age grade trial data set. regression model table summarize present results just one line code {gtsummary}. Note sensible defaults basic usage (can customized later): model recognized logistic regression coefficients exponentiated, header displayed “” odds ratio. Variable types automatically detected reference rows added categorical variables. Model estimates confidence intervals rounded formatted. variables data set labelled, labels carried {gtsummary} output table. data labelled, default display variable name. Variable levels indented footnotes added.","code":"# build logistic regression model m1 <- glm(response ~ age + stage, trial, family = binomial) # view raw model results summary(m1)$coefficients #> Estimate Std. Error z value Pr(>|z|) #> (Intercept) -1.48622424 0.62022844 -2.3962530 0.01656365 #> age 0.01939109 0.01146813 1.6908683 0.09086195 #> stageT2 -0.54142643 0.44000267 -1.2305071 0.21850725 #> stageT3 -0.05953479 0.45042027 -0.1321761 0.89484501 #> stageT4 -0.23108633 0.44822835 -0.5155549 0.60616530 tbl_regression(m1, exponentiate = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"customize-output","dir":"Articles","previous_headings":"","what":"Customize Output","title":"tbl_regression() tutorial","text":"four primary ways customize output regression model table. Modify tbl_regression() function input arguments Add additional data/information summary table add_*() functions Modify summary table appearance {gtsummary} functions Modify table appearance {gt} package functions","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"modifying-function-arguments","dir":"Articles","previous_headings":"Customize Output","what":"Modifying function arguments","title":"tbl_regression() tutorial","text":"tbl_regression() function includes many arguments modifying appearance.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"gtsummary-functions-to-add-information","dir":"Articles","previous_headings":"Customize Output","what":"{gtsummary} functions to add information","title":"tbl_regression() tutorial","text":"{gtsummary} package built-functions adding results tbl_regression(). following functions add columns /information regression table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"gtsummary-functions-to-format-table","dir":"Articles","previous_headings":"Customize Output","what":"{gtsummary} functions to format table","title":"tbl_regression() tutorial","text":"{gtsummary} package comes functions specifically made modify format summary tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"gt-functions-to-format-table","dir":"Articles","previous_headings":"Customize Output","what":"{gt} functions to format table","title":"tbl_regression() tutorial","text":"{gt} package packed many great functions modifying table output—many list . Review package’s website full listing. use {gt} package functions {gtsummary} tables, regression table must first converted {gt} object. end, use as_gt() function modifications completed {gtsummary} functions.","code":"m1 |> tbl_regression(exponentiate = TRUE) |> as_gt() |> gt::tab_source_note(gt::md(\"*This data is simulated*\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"example","dir":"Articles","previous_headings":"Customize Output","what":"Example","title":"tbl_regression() tutorial","text":"formatting options available, adding bold italics text. example , - Coefficients exponentiated give odds ratios - Global p-values Stage reported - Large p-values rounded two decimal places - P-values less 0.10 bold - Variable labels bold - Variable levels italicized","code":"# format results into data frame with global p-values m1 |> tbl_regression( exponentiate = TRUE, pvalue_fun = label_style_pvalue(digits = 2), ) |> add_global_p() |> bold_p(t = 0.10) |> bold_labels() |> italicize_levels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"tbl_uvregression","dir":"Articles","previous_headings":"","what":"Univariate Regression","title":"tbl_regression() tutorial","text":"tbl_uvregression() function produces table univariate regression models. function wrapper tbl_regression(), result, accepts nearly identical function arguments. function’s results can modified similar ways tbl_regression().","code":"trial |> tbl_uvregression( method = glm, y = response, include = c(age, grade), method.args = list(family = binomial), exponentiate = TRUE, pvalue_fun = label_style_pvalue(digits = 2) ) |> add_global_p() |> # add global p-value add_nevent() |> # add number of events of the outcome add_q() |> # adjusts global p-values for multiple testing bold_p() |> # bold p-values under a given threshold (default 0.05) bold_p(t = 0.10, q = TRUE) |> # now bold q-values under the threshold of 0.10 bold_labels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"options","dir":"Articles","previous_headings":"","what":"Setting Default Options","title":"tbl_regression() tutorial","text":"{gtsummary} regression functions related functions sensible defaults rounding formatting results. , however, like change defaults options. default options can changed using {gtsummary} themes function set_gtsummary_theme(). package includes pre-specified themes, can also create . Themes can control baseline behavior, example, p-values rounded, coefficients rounded, default headers, confidence levels, etc. details creating theme setting personal defaults, visit themes vignette.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_regression.html","id":"supported-models","dir":"Articles","previous_headings":"","what":"Supported Models","title":"tbl_regression() tutorial","text":"listing known tested models supported tbl_regression(). model follows standard format tidier, ’s likely supported well, even listed .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"introduction","dir":"Articles","previous_headings":"","what":"Introduction","title":"tbl_summary() tutorial","text":"tbl_summary() function calculates descriptive statistics continuous, categorical, dichotomous variables R, presents results beautiful, customizable summary table ready publication (example, Table 1 demographic tables). vignette walk reader tbl_summary() function, various functions available modify make additions existing table summary object.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"setup","dir":"Articles","previous_headings":"","what":"Setup","title":"tbl_summary() tutorial","text":"going tutorial, install load {gtsummary}.","code":"# install.packages(\"gtsummary\") library(gtsummary)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"example-data-set","dir":"Articles","previous_headings":"","what":"Example data set","title":"tbl_summary() tutorial","text":"’ll using trial data set throughout example. set contains data 200 patients received one two types chemotherapy (Drug Drug B). outcomes tumor response death. variable data frame assigned attribute label (.e. attr(trial$trt, \"label\") == \"Chemotherapy Treatment\") labelled package. labels displayed {gtsummary} output table default. Using {gtsummary} data frame without labels simply print variable names place variable labels; also option add labels later. brevity, tutorial ’ll use subset variables trial data set.","code":"head(trial) #> # A tibble: 6 × 8 #> trt age marker stage grade response death ttdeath #> #> 1 Drug A 23 0.16 T1 II 0 0 24 #> 2 Drug B 9 1.11 T2 I 1 0 24 #> 3 Drug A 31 0.277 T1 II 0 0 24 #> 4 Drug A NA 2.07 T3 III 1 1 17.6 #> 5 Drug A 51 2.77 T4 III 1 1 16.4 #> 6 Drug B 39 0.613 T4 I 0 1 15.6 trial2 <- trial |> select(trt, age, grade)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"basic-usage","dir":"Articles","previous_headings":"","what":"Basic Usage","title":"tbl_summary() tutorial","text":"default output tbl_summary() meant publication ready. Let’s start creating table summary statistics trial data set. tbl_summary() function can take, minimum, data frame input, returns descriptive statistics column data frame. Note sensible defaults basic usage; defaults may customized. Variable types automatically detected appropriate descriptive statistics calculated. Label attributes data set automatically printed. Missing values listed “Unknown” table. Variable levels indented footnotes added. study data summary statistics split treatment group, can done using = argument. compare two groups, include add_p() function call, detects variable type uses appropriate statistical test.","code":"trial2 |> tbl_summary() trial2 |> tbl_summary(by = trt) |> add_p()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"customize-output","dir":"Articles","previous_headings":"","what":"Customize Output","title":"tbl_summary() tutorial","text":"four primary ways customize output summary table. Use tbl_summary() function arguments Add additional data/information summary table add_*() functions Modify summary table appearance {gtsummary} functions Modify table appearance {gt} package functions","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"modifying-tbl_summary-function-arguments","dir":"Articles","previous_headings":"Customize Output","what":"Modifying tbl_summary() function arguments","title":"tbl_summary() tutorial","text":"tbl_summary() function includes many input options modifying appearance. Example modifying tbl_summary() arguments. multiple ways specify statistic= argument using single formula, list formulas, named list. following table shows equivalent ways specify mean statistic continuous variables age marker. {gtsummary} function argument accepts formulas accept variations.","code":"trial2 |> tbl_summary( by = trt, statistic = list( all_continuous() ~ \"{mean} ({sd})\", all_categorical() ~ \"{n} / {N} ({p}%)\" ), digits = all_continuous() ~ 2, label = grade ~ \"Tumor Grade\", missing_text = \"(Missing)\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"gtsummary-functions-to-add-information","dir":"Articles","previous_headings":"Customize Output","what":"{gtsummary} functions to add information","title":"tbl_summary() tutorial","text":"{gtsummary} package functions adding information statistics tbl_summary() tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"gtsummary-functions-to-format-table","dir":"Articles","previous_headings":"Customize Output","what":"{gtsummary} functions to format table","title":"tbl_summary() tutorial","text":"{gtsummary} package comes functions specifically made modify format summary tables. Example adding tbl_summary()-family functions Table 1. Patient Characteristics","code":"trial2 |> tbl_summary(by = trt) |> add_p(pvalue_fun = label_style_pvalue(digits = 2)) |> add_overall() |> add_n() |> modify_header(label ~ \"**Variable**\") |> modify_spanning_header(c(\"stat_1\", \"stat_2\") ~ \"**Treatment Received**\") |> modify_footnote_header(\"Median (IQR) or Frequency (%)\", columns = all_stat_cols()) |> modify_caption(\"**Table 1. Patient Characteristics**\") |> bold_labels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"gt-functions-to-format-table","dir":"Articles","previous_headings":"Customize Output","what":"{gt} functions to format table","title":"tbl_summary() tutorial","text":"{gt} package packed many great functions modifying table output—many list . Review package’s website full listing. use {gt} package functions {gtsummary} tables, summary table must first converted gt object. end, use as_gt() function modifications completed {gtsummary} functions.","code":"trial2 |> tbl_summary(by = trt, missing = \"no\") |> add_n() |> as_gt() |> gt::tab_source_note(gt::md(\"*This data is simulated*\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"select_helpers","dir":"Articles","previous_headings":"","what":"Select Helpers","title":"tbl_summary() tutorial","text":"flexibility select variables {gtsummary} arguments, allows many customization opportunities! example, want show age marker levels one decimal place tbl_summary(), can pass digits = c(age, marker) ~ 1. selecting input flexible, may also pass quoted column names. Going beyond typing specific variables data set, can use: {tidyselect} helpers available throughout tidyverse, starts_with(), contains(), everything() (.e. anything can use dplyr::select() function), can used {gtsummary}. Additional {gtsummary} selectors included package supplement tidyselect functions. Summary type two primary ways select variables summary type. useful, example, wish report mean standard deviation continuous variables: statistic = all_continuous() ~ \"{mean} ({sd})\". Dichotomous variables , default, included all_categorical().","code":"all_continuous() all_categorical()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"continuous2","dir":"Articles","previous_headings":"","what":"Multi-line Continuous Summaries","title":"tbl_summary() tutorial","text":"Continuous variables may also summarized multiple lines—common format journals. update continuous variables summarize multiple lines, update summary type \"continuous2\" (summaries two lines).","code":"trial2 |> select(age, trt) |> tbl_summary( by = trt, type = all_continuous() ~ \"continuous2\", statistic = all_continuous() ~ c( \"{N_nonmiss}\", \"{median} ({p25}, {p75})\", \"{min}, {max}\" ), missing = \"no\" ) |> add_p(pvalue_fun = label_style_pvalue(digits = 2))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"advanced","dir":"Articles","previous_headings":"","what":"Advanced Customization","title":"tbl_summary() tutorial","text":"information section applies {gtsummary} objects. {gtsummary} table two important internal objects: print output tbl_summary() function R console R markdown document, .$table_body data frame formatted using instructions listed .$table_styling. default printer converts {gtsummary} object {gt} object as_gt() via sequence {gt} commands executed .$table_body. ’s example first calls saved tbl_summary(): {gt} functions called order appear, beginning gt::gt(). user want specific {gt} function run (.e. like change default printing), {gt} call can excluded as_gt() function. example , default alignment restored. as_gt() function run, additional formatting may added table using {gt} functions. example , source note added table.","code":"tbl_summary(trial2) |> as_gt(return_calls = TRUE) |> head(n = 4) #> $gt #> gt::gt(data = x$table_body, groupname_col = NULL, caption = NULL) #> #> $fmt_missing #> $fmt_missing[[1]] #> gt::sub_missing(columns = gt::everything(), missing_text = \"\") #> #> #> $cols_merge #> list() #> #> $cols_align #> $cols_align[[1]] #> gt::cols_align(columns = c(\"variable\", \"var_type\", \"row_type\", #> \"var_label\", \"stat_0\"), align = \"center\") #> #> $cols_align[[2]] #> gt::cols_align(columns = \"label\", align = \"left\") tbl_summary(trial2, by = trt) |> as_gt(include = -cols_align) |> gt::tab_source_note(gt::md(\"*This data is simulated*\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"options","dir":"Articles","previous_headings":"","what":"Set Default Options with Themes","title":"tbl_summary() tutorial","text":"{gtsummary} tbl_summary() function related functions sensible defaults rounding presenting results. , however, like change defaults options. default options can changed using {gtsummary} themes function set_gtsummary_theme(). package includes prespecified themes, can also create . Themes can control baseline behavior, example, p-values percentages rounded, statistics presented tbl_summary(), default statistical tests add_p(), etc. details creating theme setting personal defaults, review themes vignette.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"tbl_svysummary","dir":"Articles","previous_headings":"","what":"Survey Data","title":"tbl_summary() tutorial","text":"{gtsummary} package also supports survey data (objects created {survey} package) via tbl_svysummary() function. syntax tbl_svysummary() tbl_summary() nearly identical, examples apply survey summaries well. begin, install {survey} package load apiclus1 data set. begin, convert data frame survey object, registering ID weighting columns, setting finite population correction column. creating survey object, can now summarize similarly standard data frame using tbl_svysummary(). Like tbl_summary(), tbl_svysummary() accepts = argument works add_p() add_overall() functions. possible pass custom functions statistic= argument tbl_svysummary(). must use one pre-defined summary statistic functions (e.g. {mean}, {median}) leverage functions {survey} package calculate weighted statistics. tbl_svysummary() can also handle weighted survey data row represents several individuals:","code":"install.packages(\"survey\") # loading the api data set data(api, package = \"survey\") svy_apiclus1 <- survey::svydesign( id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc ) svy_apiclus1 |> tbl_svysummary( # stratify summary statistics by the \"both\" column by = both, # summarize a subset of the columns include = c(api00, api99, both), # adding labels to table label = list(api00 = \"API in 2000\", api99 = \"API in 1999\") ) |> add_p() |> # comparing values by \"both\" column add_overall() |> # adding spanning header modify_spanning_header(c(\"stat_1\", \"stat_2\") ~ \"**Met Both Targets**\") Titanic |> as_tibble() |> survey::svydesign(data = _, ids = ~1, weights = ~n) |> tbl_svysummary(include = c(Age, Survived))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/tbl_summary.html","id":"tbl_cross","dir":"Articles","previous_headings":"","what":"Cross Tables","title":"tbl_summary() tutorial","text":"Use tbl_cross() compare two categorical variables data. tbl_cross() wrapper tbl_summary() : Automatically adds spanning header table name label comparison variable. Uses percent = \"cell\" default. Adds row column margin totals (customizable margin argument). Displays missing data row column variables (customizable missing argument).","code":"trial |> tbl_cross( row = stage, col = trt, percent = \"cell\" ) |> add_p()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"setting-themes","dir":"Articles","previous_headings":"","what":"Setting Themes","title":"gtsummary themes","text":"set pre-defined theme, simply include theme function script R console. Use set_gtsummary_theme() function set user-defined themes (). Themes must set create {gtsummary} tables. Let’s take look default table, comparing data treatment groups.","code":"theme_gtsummary_journal(journal = \"jama\") set_gtsummary_theme(my_custom_theme)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"default-theme","dir":"Articles","previous_headings":"Setting Themes","what":"Default Theme","title":"gtsummary themes","text":"","code":"library(gtsummary) trial |> tbl_summary(by = trt, include = c(age, grade)) |> add_p()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"jama-theme","dir":"Articles","previous_headings":"Setting Themes","what":"JAMA Theme","title":"gtsummary themes","text":"Now, code JAMA theme. setting theme, able change default formatting p-value add dash 25th 75th percentiles.","code":"theme_gtsummary_journal(journal = \"jama\") #> Setting theme \"JAMA\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"jama-compact-theme","dir":"Articles","previous_headings":"Setting Themes","what":"JAMA + Compact Theme","title":"gtsummary themes","text":"Themes can stacked well. example , JAMA theme compact theme (reduces font size cell padding) called themes utilized.","code":"theme_gtsummary_journal(journal = \"jama\") #> Setting theme \"JAMA\" theme_gtsummary_compact() #> Setting theme \"Compact\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"jama-compact-language-theme","dir":"Articles","previous_headings":"Setting Themes","what":"JAMA + Compact + Language Theme","title":"gtsummary themes","text":"{gtsummary} tables can translated another language using theme_gtsummary_language()! Clear previously set themes using reset_gtsummary_theme().","code":"reset_gtsummary_theme()"},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"theme-structure","dir":"Articles","previous_headings":"Writing Themes","what":"Theme Structure","title":"gtsummary themes","text":"many parts {gtsummary} table may controlled theme elements. construct personalized theme, create named list least one theme element. ’s example theme modifies function styles p-values updates default statistics reported tbl_summary(). create theme, first check structure using check_gtsummary_theme(). apply set theme set_gtsummary_theme().","code":"my_theme <- list( # round large p-values to two places \"pkgwide-fn:pvalue_fun\" = label_style_pvalue(digits = 2), \"pkgwide-fn:prependpvalue_fun\" = label_style_pvalue(digits = 2, prepend_p = TRUE), # report median (Q1 - Q2) and n (percent) as default stats in `tbl_summary()` \"tbl_summary-arg:statistic\" = list(all_continuous() ~ \"{median} ({p25} - {p75})\", all_categorical() ~ \"{n} ({p})\") ) set_gtsummary_theme(my_theme)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/articles/themes.html","id":"theme-elements","dir":"Articles","previous_headings":"Writing Themes","what":"Theme Elements","title":"gtsummary themes","text":"theme element follows naming structure: \"-:\". function name function change applies , input type specifies class type theme element, description brief text characterizing theme element. Theme elements fall two categories. first modifying internal behavior functions directly controllable function arguments. second type theme elements set function argument defaults. values theme elements must align functions’ accepted input argument.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Daniel D. Sjoberg. Author, maintainer. Joseph Larmarange. Author. Michael Curry. Author. Jessica Lavery. Author. Karissa Whiting. Author. Emily C. Zabor. Author. Xing Bai. Contributor. Esther Drill. Contributor. Jessica Flynn. Contributor. Margie Hannum. Contributor. Stephanie Lobaugh. Contributor. Shannon Pileggi. Contributor. Amy Tin. Contributor. Gustavo Zapata Wainberg. Contributor.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Sjoberg DD, Whiting K, Curry M, Lavery JA, Larmarange J. Reproducible summary tables gtsummary package. R Journal 2021;13:570–80. https://doi.org/10.32614/RJ-2021-053.","code":"@Article{gtsummary, author = {Daniel D. Sjoberg and Karissa Whiting and Michael Curry and Jessica A. Lavery and Joseph Larmarange}, title = {Reproducible Summary Tables with the gtsummary Package}, journal = {{The R Journal}}, year = {2021}, url = {https://doi.org/10.32614/RJ-2021-053}, doi = {10.32614/RJ-2021-053}, volume = {13}, issue = {1}, pages = {570-580}, }"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"gtsummary-","dir":"","previous_headings":"","what":"gtsummary","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"{gtsummary} package provides elegant flexible way create publication-ready analytical summary tables using R programming language. {gtsummary} package summarizes data sets, regression models, , using sensible defaults highly customizable capabilities. Summarize data frames tibbles easily R. Perfect presenting descriptive statistics, comparing group demographics (e.g creating Table 1 medical journals), . Automatically detects continuous, categorical, dichotomous variables data set, calculates appropriate descriptive statistics, also includes amount missingness variable. Summarize regression models R include reference rows categorical variables. Common regression models, logistic regression Cox proportional hazards regression, automatically identified tables pre-filled appropriate column headers (.e. Odds Ratio Hazard Ratio). Customize gtsummary tables using growing list formatting/styling functions. Bold labels, italicize levels, add p-value summary tables, style statistics however choose, merge stack tables present results side side… many possibilities create table dreams! Report statistics inline summary tables regression summary tables R markdown. Make reports completely reproducible! leveraging {broom}, {gt}, {labelled} packages, {gtsummary} creates beautifully formatted, ready--share summary result tables single line R code! Check examples , review vignettes detailed exploration output options, view gallery various customization examples.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"installation","dir":"","previous_headings":"","what":"Installation","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"{gtsummary} package written companion {gt} package RStudio. can install {gtsummary} following code. Install development version pak::pkg_install(\"ddsjoberg/gtsummary\", dependencies = TRUE)","code":"install.packages(\"gtsummary\")"},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"summary-table","dir":"","previous_headings":"Examples","what":"Summary Table","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"Use tbl_summary() summarize data frame. Example basic table: many customization options add information (like comparing groups) format results (like bold labels) table. See tbl_summary() tutorial many options, one example.","code":"library(gtsummary) # summarize the data with our package table1 <- trial |> tbl_summary(include = c(age, grade, response)) table2 <- tbl_summary( trial, include = c(age, grade, response), by = trt, # split table by group missing = \"no\" # don't list missing data separately ) |> add_n() |> # add column with total number of non-missing observations add_p() |> # test for a difference between groups modify_header(label = \"**Variable**\") |> # update the column header bold_labels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"regression-models","dir":"","previous_headings":"Examples","what":"Regression Models","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"Use tbl_regression() easily beautifully display regression model results table. See tutorial customization options.","code":"mod1 <- glm(response ~ trt + age + grade, trial, family = binomial) t1 <- tbl_regression(mod1, exponentiate = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"side-by-side-regression-models","dir":"","previous_headings":"Examples","what":"Side-by-side Regression Models","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"can also present side--side regression model results using tbl_merge() Review even output options table gallery.","code":"library(survival) # build survival model table t2 <- coxph(Surv(ttdeath, death) ~ trt + grade + age, trial) |> tbl_regression(exponentiate = TRUE) # merge tables tbl_merge_ex1 <- tbl_merge( tbls = list(t1, t2), tab_spanner = c(\"**Tumor Response**\", \"**Time to Death**\") )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"gtsummary--r-markdown","dir":"","previous_headings":"","what":"gtsummary + R Markdown","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"{gtsummary} package written companion {gt} package RStudio. output types supported {gt} package. Therefore, made possible print {gtsummary} tables various engines. Review gtsummary + R Markdown vignette details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"save-individual-tables","dir":"","previous_headings":"","what":"Save Individual Tables","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"{gtsummary} tables can also saved directly file image, HTML, Word, RTF, LaTeX file.","code":"tbl |> as_gt() |> gt::gtsave(filename = \".\") # use extensions .png, .html, .docx, .rtf, .tex, .ltx"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"additional-resources","dir":"","previous_headings":"","what":"Additional Resources","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"best resources gtsummary vignettes: table gallery, tbl_summary() tutorial, tbl_regression() tutorial, inline_text() tutorial, gtsummary themes, gtsummary+R markdown. R Journal Article Reproducible Summary Tables gtsummary Package. RStudio Education Blog includes post brief introduction package. recording presentation given Weill Cornell Biostatistics Department Memorial Sloan Kettering R Users Group.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"cite-gtsummary","dir":"","previous_headings":"","what":"Cite gtsummary","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"","code":"> citation(\"gtsummary\") To cite gtsummary in publications use: Sjoberg DD, Whiting K, Curry M, Lavery JA, Larmarange J. Reproducible summary tables with the gtsummary package. The R Journal 2021;13:570–80. https://doi.org/10.32614/RJ-2021-053. A BibTeX entry for LaTeX users is @Article{gtsummary, author = {Daniel D. Sjoberg and Karissa Whiting and Michael Curry and Jessica A. Lavery and Joseph Larmarange}, title = {Reproducible Summary Tables with the gtsummary Package}, journal = {{The R Journal}}, year = {2021}, url = {https://doi.org/10.32614/RJ-2021-053}, doi = {10.32614/RJ-2021-053}, volume = {13}, issue = {1}, pages = {570-580}, }"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/index.html","id":"contributing","dir":"","previous_headings":"","what":"Contributing","title":"Presentation-Ready Data Summary and Analytic Result Tables","text":"Big thank @jeffreybears hex sticker! Please note {gtsummary} project released Contributor Code Conduct. contributing project, agree abide terms. Thank contributors!","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":null,"dir":"Reference","previous_headings":"","what":"Add CI Column — add_ci","title":"Add CI Column — add_ci","text":"Add new column confidence intervals proportions, means, etc.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add CI Column — add_ci","text":"","code":"add_ci(x, ...) # S3 method for class 'tbl_summary' add_ci( x, method = list(all_continuous() ~ \"t.test\", all_categorical() ~ \"wilson\"), include = everything(), statistic = list(all_continuous() ~ \"{conf.low}, {conf.high}\", all_categorical() ~ \"{conf.low}%, {conf.high}%\"), conf.level = 0.95, style_fun = list(all_continuous() ~ label_style_sigfig(), all_categorical() ~ label_style_sigfig(scale = 100)), pattern = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add CI Column — add_ci","text":"x (tbl_summary) summary table class 'tblsummary' ... dots future extensions must empty. method (formula-list-selector) Confidence interval method. Default list(all_continuous() ~ \"t.test\", all_categorical() ~ \"wilson\"). See details . include (tidy-select) Variables include summary table. Default everything(). statistic (formula-list-selector) Indicates confidence interval displayed. Default list(all_continuous() ~ \"{conf.low}, {conf.high}\", all_categorical() ~ \"{conf.low}%, {conf.high}%\") conf.level (scalar real) Confidence level. Default 0.95 style_fun (function) Function style upper lower bound confidence interval. Default list(all_continuous() ~ label_style_sigfig(), all_categorical() ~ label_style_sigfig(scale = 100)). pattern (string) Indicates pattern use merge CI statistics cell. default NULL, columns merged. two columns merged statistics column, represented \"{stat}\" CI column represented \"{ci}\", e.g. pattern = \"{stat} ({ci})\" merge two columns CI parentheses. Default NULL, merging performed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add CI Column — add_ci","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"method-argument","dir":"Reference","previous_headings":"","what":"method argument","title":"Add CI Column — add_ci","text":"Must one \"wilson\", \"wilson..correct\" calculated via prop.test(correct = c(TRUE, FALSE)) categorical variables \"exact\" calculated via stats::binom.test() categorical variables \"wald\", \"wald..correct\" calculated via cardx::proportion_ci_wald(correct = c(TRUE, FALSE) categorical variables \"agresti.coull\" calculated via cardx::proportion_ci_agresti_coull() categorical variables \"jeffreys\" calculated via cardx::proportion_ci_jeffreys() categorical variables \"t.test\" calculated via stats::t.test() continuous variables \"wilcox.test\" calculated via stats::wilcox.test() continuous variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add CI Column — add_ci","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary( missing = \"no\", statistic = all_continuous() ~ \"{mean} ({sd})\", include = c(marker, response, trt) ) |> add_ci() Characteristic N = 2001 95% CI Marker Level (ng/mL) 0.92 (0.86) 0.79, 1.0Tumor Response 61 (32%) 25%, 39%Chemotherapy Treatment     Drug A 98 (49%) 42%, 56%    Drug B 102 (51%) 44%, 58%Abbreviation: CI = Confidence Interval 1 Mean (SD); n (%) # Example 2 ---------------------------------- trial |> select(response, grade) %>% tbl_summary( statistic = all_categorical() ~ \"{p}%\", missing = \"no\", include = c(response, grade) ) |> add_ci(pattern = \"{stat} ({ci})\") |> remove_footnote_header(everything()) Characteristic N = 200 (95% CI) Tumor Response 32% (25%, 39%)Grade     I 34% (28%, 41%)    II 34% (28%, 41%)    III 32% (26%, 39%)Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add CI Column — add_ci.tbl_svysummary","title":"Add CI Column — add_ci.tbl_svysummary","text":"Add new column confidence intervals proportions, means, etc.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add CI Column — add_ci.tbl_svysummary","text":"","code":"# S3 method for class 'tbl_svysummary' add_ci( x, method = list(all_continuous() ~ \"svymean\", all_categorical() ~ \"svyprop.logit\"), include = everything(), statistic = list(all_continuous() ~ \"{conf.low}, {conf.high}\", all_categorical() ~ \"{conf.low}%, {conf.high}%\"), conf.level = 0.95, style_fun = list(all_continuous() ~ label_style_sigfig(), all_categorical() ~ label_style_sigfig(scale = 100)), pattern = NULL, df = survey::degf(x$inputs$data), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add CI Column — add_ci.tbl_svysummary","text":"x (tbl_summary) summary table class 'tblsummary' method (formula-list-selector) Confidence interval method. Default list(all_continuous() ~ \"svymean\", all_categorical() ~ \"svyprop.logit\"). See details . include (tidy-select) Variables include summary table. Default everything(). statistic (formula-list-selector) Indicates confidence interval displayed. Default list(all_continuous() ~ \"{conf.low}, {conf.high}\", all_categorical() ~ \"{conf.low}%, {conf.high}%\") conf.level (scalar real) Confidence level. Default 0.95 style_fun (function) Function style upper lower bound confidence interval. Default list(all_continuous() ~ label_style_sigfig(), all_categorical() ~ label_style_sigfig(scale = 100)). pattern (string) Indicates pattern use merge CI statistics cell. default NULL, columns merged. two columns merged statistics column, represented \"{stat}\" CI column represented \"{ci}\", e.g. pattern = \"{stat} ({ci})\" merge two columns CI parentheses. Default NULL, merging performed. df (numeric) denominator degrees freedom, passed survey::svyciprop(df) confint(df). Default survey::degf(x$inputs$data). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add CI Column — add_ci.tbl_svysummary","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"method-argument","dir":"Reference","previous_headings":"","what":"method argument","title":"Add CI Column — add_ci.tbl_svysummary","text":"Must one \"svyprop.logit\", \"svyprop.likelihood\", \"svyprop.asin\", \"svyprop.beta\", \"svyprop.mean\", \"svyprop.xlogit\" calculated via survey::svyciprop() categorical variables \"svymean\" calculated via survey::svymean() continuous variables \"svymedian.mean\", \"svymedian.beta\", \"svymedian.xlogit\", \"svymedian.asin\", \"svymedian.score\" calculated via survey::svyquantile(quantiles = 0.5) continuous variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_ci.tbl_svysummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add CI Column — add_ci.tbl_svysummary","text":"","code":"data(api, package = \"survey\") survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) |> tbl_svysummary( by = \"both\", include = c(api00, stype), statistic = all_continuous() ~ \"{mean} ({sd})\" ) |> add_stat_label() |> add_ci(pattern = \"{stat} (95% CI {ci})\") |> modify_header(all_stat_cols() ~ \"**{level}**\") |> modify_spanning_header(all_stat_cols() ~ \"**Survived**\") Characteristic Survived No Yes api00, Mean (SD) 633 (96) (95% CI 570, 696) 648 (109) (95% CI 600, 697)stype, n (%)     E 1,083 (64%) (95% CI 43%, 81%) 3,791 (84%) (95% CI 73%, 91%)    H 237 (14%) (95% CI 6.6%, 27%) 237 (5.3%) (95% CI 2.1%, 13%)    M 372 (22%) (95% CI 8.7%, 46%) 474 (11%) (95% CI 5.7%, 19%)Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.html","id":null,"dir":"Reference","previous_headings":"","what":"Add differences — add_difference","title":"Add differences — add_difference","text":"add_difference.tbl_summary() add_difference.tbl_svysummary()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add differences — add_difference","text":"","code":"add_difference(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add differences — add_difference","text":"x (gtsummary) Object class 'gtsummary' ... Passed methods.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add differences — add_difference","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add differences between groups — add_difference.tbl_summary","title":"Add differences between groups — add_difference.tbl_summary","text":"Adds difference tables created tbl_summary(). difference two groups (typically mean rate difference) added table along difference's confidence interval p-value (applicable).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add differences between groups — add_difference.tbl_summary","text":"","code":"# S3 method for class 'tbl_summary' add_difference( x, test = NULL, group = NULL, adj.vars = NULL, test.args = NULL, conf.level = 0.95, include = everything(), pvalue_fun = label_style_pvalue(digits = 1), estimate_fun = list(c(all_continuous(), all_categorical(FALSE)) ~ label_style_sigfig(), all_dichotomous() ~ label_style_sigfig(scale = 100, suffix = \"%\"), all_tests(\"smd\") ~ label_style_sigfig()), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add differences between groups — add_difference.tbl_summary","text":"x (tbl_summary) table created tbl_summary() test (formula-list-selector) Specifies tests/methods perform variable, e.g. list(all_continuous() ~ \"t.test\", all_dichotomous() ~ \"prop.test\", all_categorical(FALSE) ~ \"smd\"). See details default tests ?tests details available tests creating custom tests. group (tidy-select) Variable name ID grouping variable. column can used calculate p-values correlated data. Default NULL. See tests methods utilize group argument. adj.vars (tidy-select) Variables include adjusted calculations (e.g. ANCOVA models). Default NULL. test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). conf.level (numeric) scalar interval (0, 1) indicating confidence level. Default 0.95 include (tidy-select) Variables include output. Default everything(). pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). estimate_fun (formula-list-selector) List formulas specifying functions round format differences confidence limits. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add differences between groups — add_difference.tbl_summary","text":"gtsummary table class \"tbl_summary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add differences between groups — add_difference.tbl_summary","text":"","code":"# Example 1 ---------------------------------- trial |> select(trt, age, marker, response, death) %>% tbl_summary( by = trt, statistic = list( all_continuous() ~ \"{mean} ({sd})\", all_dichotomous() ~ \"{p}%\" ), missing = \"no\" ) |> add_n() |> add_difference() Characteristic N Drug A N = 981 Drug B N = 1021 Difference2 95% CI2 p-value2 Age 189 47 (15) 47 (14) -0.44 -4.6, 3.7 0.8Marker Level (ng/mL) 190 1.02 (0.89) 0.82 (0.83) 0.20 -0.05, 0.44 0.12Tumor Response 193 29% 34% -4.2% -18%, 9.9% 0.6Patient Died 200 53% 59% -5.8% -21%, 9.0% 0.5Abbreviation: CI = Confidence Interval 1 Mean (SD); % 2 Welch Two Sample t-test; 2-sample test for equality of proportions with continuity correction # Example 2 ---------------------------------- # ANCOVA adjusted for grade and stage trial |> select(trt, age, marker, grade, stage) %>% tbl_summary( by = trt, statistic = list(all_continuous() ~ \"{mean} ({sd})\"), missing = \"no\", include = c(age, marker, trt) ) |> add_n() |> add_difference(adj.vars = c(grade, stage)) Characteristic N Drug A N = 981 Drug B N = 1021 Adjusted Difference2 95% CI2 p-value2 Age 189 47 (15) 47 (14) -0.36 -4.5, 3.8 0.9Marker Level (ng/mL) 190 1.02 (0.89) 0.82 (0.83) 0.19 -0.05, 0.43 0.12Abbreviation: CI = Confidence Interval 1 Mean (SD) 2 ANCOVA"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_svysummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add differences between groups — add_difference.tbl_svysummary","title":"Add differences between groups — add_difference.tbl_svysummary","text":"Adds difference tables created tbl_summary(). difference two groups (typically mean rate difference) added table along difference's confidence interval p-value (applicable).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_svysummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add differences between groups — add_difference.tbl_svysummary","text":"","code":"# S3 method for class 'tbl_svysummary' add_difference( x, test = NULL, group = NULL, adj.vars = NULL, test.args = NULL, conf.level = 0.95, include = everything(), pvalue_fun = label_style_pvalue(digits = 1), estimate_fun = list(c(all_continuous(), all_categorical(FALSE)) ~ label_style_sigfig(), all_dichotomous() ~ label_style_sigfig(scale = 100, suffix = \"%\"), all_tests(\"smd\") ~ label_style_sigfig()), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_svysummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add differences between groups — add_difference.tbl_svysummary","text":"x (tbl_summary) table created tbl_summary() test (formula-list-selector) Specifies tests/methods perform variable, e.g. list(all_continuous() ~ \"t.test\", all_dichotomous() ~ \"prop.test\", all_categorical(FALSE) ~ \"smd\"). See details default tests ?tests details available tests creating custom tests. group (tidy-select) Variable name ID grouping variable. column can used calculate p-values correlated data. Default NULL. See tests methods utilize group argument. adj.vars (tidy-select) Variables include adjusted calculations (e.g. ANCOVA models). Default NULL. test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). conf.level (numeric) scalar interval (0, 1) indicating confidence level. Default 0.95 include (tidy-select) Variables include output. Default everything(). pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). estimate_fun (formula-list-selector) List formulas specifying functions round format differences confidence limits. Default list(c(all_continuous(), all_categorical(FALSE)) ~ label_style_sigfig(), all_categorical() ~ \\(x) paste0(style_sigfig(x, scale = 100), \"%\")) ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_difference.tbl_svysummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add differences between groups — add_difference.tbl_svysummary","text":"gtsummary table class \"tbl_summary\"","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":null,"dir":"Reference","previous_headings":"","what":"Add model statistics — add_glance","title":"Add model statistics — add_glance","text":"Add model statistics returned broom::glance(). Statistics can either appended table (add_glance_table()), added table source note (add_glance_source_note()).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add model statistics — add_glance","text":"","code":"add_glance_table( x, include = everything(), label = NULL, fmt_fun = list(everything() ~ label_style_sigfig(digits = 3), any_of(\"p.value\") ~ label_style_pvalue(digits = 1), c(where(is.integer), starts_with(\"df\")) ~ label_style_number()), glance_fun = glance_fun_s3(x$inputs$x) ) add_glance_source_note( x, include = everything(), label = NULL, fmt_fun = list(everything() ~ label_style_sigfig(digits = 3), any_of(\"p.value\") ~ label_style_pvalue(digits = 1), c(where(is.integer), starts_with(\"df\")) ~ label_style_number()), glance_fun = glance_fun_s3(x$inputs$x), text_interpret = c(\"md\", \"html\"), sep1 = \" = \", sep2 = \"; \" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add model statistics — add_glance","text":"x (tbl_regression) 'tbl_regression' object include (tidy-select) names statistics include output. Must column names tibble returned broom::glance() glance_fun argument. include argument can also used specify order statistics appear table. label (formula-list-selector) specifies statistic labels, e.g. list(r.squared = \"R2\", p.value = \"P\") fmt_fun (formula-list-selector) Specifies functions used format/round glance statistics. default round number observations degrees freedom nearest integer, p-values styled style_pvalue() remaining statistics styled style_sigfig(x, digits = 3) glance_fun (function) function returns model statistics. Default glance_fun() (broom::glance() model objects). Custom functions must return single row tibble. text_interpret (string) String indicates whether source note text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". sep1 (string) Separator statistic name statistic. Default \" = \", e.g. \"R2 = 0.456\" sep2 (string) Separator statistics. Default \"; \"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add model statistics — add_glance","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"tips","dir":"Reference","previous_headings":"","what":"Tips","title":"Add model statistics — add_glance","text":"combining add_glance_table() tbl_merge(), ordering model terms glance statistics may become jumbled. re-order rows glance statistics bottom, use script :","code":"tbl_merge(list(tbl1, tbl2)) %>% modify_table_body(~.x %>% arrange(row_type == \"glance_statistic\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_glance.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add model statistics — add_glance","text":"","code":"mod <- lm(age ~ marker + grade, trial) |> tbl_regression() # Example 1 ---------------------------------- mod |> add_glance_table( label = list(sigma = \"\\U03C3\"), include = c(r.squared, AIC, sigma) ) Characteristic Beta 95% CI p-value Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9Grade     I — —     II 0.64 -4.7, 6.0 0.8    III 2.4 -2.8, 7.6 0.4R² 0.005 AIC 1,473 σ 14.6 Abbreviation: CI = Confidence Interval # Example 2 ---------------------------------- mod |> add_glance_source_note( label = list(sigma = \"\\U03C3\"), include = c(r.squared, AIC, sigma) ) Characteristic Beta 95% CI p-value Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9Grade     I — —     II 0.64 -4.7, 6.0 0.8    III 2.4 -2.8, 7.6 0.4Abbreviation: CI = Confidence Interval R² = 0.005; AIC = 1,473; σ = 14.6"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":null,"dir":"Reference","previous_headings":"","what":"Add the global p-values — add_global_p","title":"Add the global p-values — add_global_p","text":"function uses car::Anova() (default) calculate global p-values model covariates. Output tbl_regression tbl_uvregression objects supported.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add the global p-values — add_global_p","text":"","code":"add_global_p(x, ...) # S3 method for class 'tbl_regression' add_global_p( x, include = everything(), keep = FALSE, anova_fun = global_pvalue_fun, type = \"III\", quiet, ... ) # S3 method for class 'tbl_uvregression' add_global_p( x, include = everything(), keep = FALSE, anova_fun = global_pvalue_fun, type = \"III\", quiet, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add the global p-values — add_global_p","text":"x (tbl_regression, tbl_uvregression) Object class 'tbl_regression' 'tbl_uvregression' ... Additional arguments passed car::Anova, aod::wald.test() anova_fun (specified) include (tidy-select) Variables calculate global p-value . Default everything() keep (scalar logical) Logical argument indicating whether also retain individual p-values table output level categorical variable. Default FALSE. anova_fun (function) Function used calculate global p-values. Default generic global_pvalue_fun(), wraps car::Anova() models. type argument passed function. See help file details. pass custom function, must accept first argument model. Note anything passed ... passed function. function must return object class 'cards' (see cardx::ard_car_anova() example), tibble columns 'term' 'p.value' (e.g. \\(x, type, ...) car::Anova(x, type, ...) |> broom::tidy()). type Type argument passed anova_fun. Default \"III\" quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add the global p-values — add_global_p","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_global_p.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add the global p-values — add_global_p","text":"","code":"# Example 1 ---------------------------------- lm(marker ~ age + grade, trial) |> tbl_regression() |> add_global_p() Characteristic Beta 95% CI p-value Age 0.00 -0.01, 0.01 >0.9Grade 0.047    I — —     II -0.38 -0.69, -0.07     III -0.12 -0.43, 0.19 Abbreviation: CI = Confidence Interval # Example 2 ---------------------------------- trial[c(\"response\", \"age\", \"trt\", \"grade\")] |> tbl_uvregression( method = glm, y = response, method.args = list(family = binomial), exponentiate = TRUE ) |> add_global_p() Characteristic N OR 95% CI p-value Age 183 1.02 1.00, 1.04 0.091Chemotherapy Treatment 193 0.5    Drug A — —     Drug B 1.21 0.66, 2.24 Grade 193 >0.9    I — —     II 0.95 0.45, 2.00     III 1.10 0.52, 2.29 Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.html","id":null,"dir":"Reference","previous_headings":"","what":"Add column with N — add_n","title":"Add column with N — add_n","text":"add_n.tbl_summary() add_n.tbl_svysummary() add_n.tbl_regression() add_n.tbl_uvregression() add_n.tbl_survfit()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add column with N — add_n","text":"","code":"add_n(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add column with N — add_n","text":"x (gtsummary) Object class 'gtsummary' ... Passed methods.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add column with N — add_n","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Add N — add_n.tbl_survfit","title":"Add N — add_n.tbl_survfit","text":"survfit() object summarized tbl_survfit() function add total number observations new column.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add N — add_n.tbl_survfit","text":"","code":"# S3 method for class 'tbl_survfit' add_n(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add N — add_n.tbl_survfit","text":"x object class \"tbl_survfit\" ... used","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n.tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add N — add_n.tbl_survfit","text":"","code":"library(survival) fit1 <- survfit(Surv(ttdeath, death) ~ 1, trial) fit2 <- survfit(Surv(ttdeath, death) ~ trt, trial) # Example 1 ---------------------------------- list(fit1, fit2) |> tbl_survfit(times = c(12, 24)) |> add_n() Characteristic N Time 12 Time 24 Overall 200 89% (84%, 93%) 44% (38%, 51%)Chemotherapy Treatment 200     Drug A 91% (85%, 97%) 47% (38%, 58%)    Drug B 86% (80%, 93%) 41% (33%, 52%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_regression.html","id":null,"dir":"Reference","previous_headings":"","what":"Add N to regression table — add_n_regression","title":"Add N to regression table — add_n_regression","text":"Add N regression table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_regression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add N to regression table — add_n_regression","text":"","code":"# S3 method for class 'tbl_regression' add_n(x, location = \"label\", ...) # S3 method for class 'tbl_uvregression' add_n(x, location = \"label\", ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_regression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add N to regression table — add_n_regression","text":"x (tbl_regression, tbl_uvregression) tbl_regression tbl_uvregression table location (character) location place Ns. Select one c('label', 'level'). Default 'label'. \"label\" total Ns placed variable's label row. \"level\" level counts placed variable level categorical variables, total N variable's label row continuous. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_regression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add N to regression table — add_n_regression","text":"","code":"# Example 1 ---------------------------------- trial |> select(response, age, grade) |> tbl_uvregression( y = response, exponentiate = TRUE, method = glm, method.args = list(family = binomial), hide_n = TRUE ) |> add_n(location = \"label\") Characteristic N OR 95% CI p-value Age 183 1.02 1.00, 1.04 0.10Grade 193     I — —     II 0.95 0.45, 2.00 0.9    III 1.10 0.52, 2.29 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio # Example 2 ---------------------------------- glm(response ~ age + grade, trial, family = binomial) |> tbl_regression(exponentiate = TRUE) |> add_n(location = \"level\") Characteristic N OR 95% CI p-value Age 183 1.02 1.00, 1.04 0.10Grade     I 65 — —     II 58 0.85 0.39, 1.85 0.7    III 60 1.01 0.47, 2.16 >0.9Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add column with N — add_n_summary","title":"Add column with N — add_n_summary","text":"variable tbl_summary table, add_n function adds column total number non-missing (missing) observations","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add column with N — add_n_summary","text":"","code":"# S3 method for class 'tbl_summary' add_n( x, statistic = \"{N_nonmiss}\", col_label = \"**N**\", footnote = FALSE, last = FALSE, ... ) # S3 method for class 'tbl_svysummary' add_n( x, statistic = \"{N_nonmiss}\", col_label = \"**N**\", footnote = FALSE, last = FALSE, ... ) # S3 method for class 'tbl_likert' add_n( x, statistic = \"{N_nonmiss}\", col_label = \"**N**\", footnote = FALSE, last = FALSE, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add column with N — add_n_summary","text":"x (tbl_summary) Object class 'tbl_summary' created tbl_summary() function. statistic (string) String indicating statistic report. Default number non-missing observation variable, statistic = \"{N_nonmiss}\". statistics available report include: \"{N_obs}\" total number observations, \"{N_nonmiss}\" number non-missing observations, \"{N_miss}\" number missing observations, \"{p_nonmiss}\" percent non-missing data, \"{p_miss}\" percent missing data argument uses glue::glue() syntax multiple statistics may reported, e.g. statistic = \"{N_nonmiss} / {N_obs} ({p_nonmiss}%)\" col_label (string) String indicating column label. Default \"**N**\" footnote (scalar logical) Logical argument indicating whether print footnote clarifying statistics presented. Default FALSE last (scalar logical) Logical indicator include N column last table. Default FALSE, display N column first. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add column with N — add_n_summary","text":"table class c('tbl_summary', 'gtsummary')","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add column with N — add_n_summary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_n_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add column with N — add_n_summary","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(trt, age, grade, response)) |> add_n() Characteristic N Drug A N = 981 Drug B N = 1021 Age 189 46 (37, 60) 48 (39, 56)    Unknown 7 4Grade 200     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)Tumor Response 193 28 (29%) 33 (34%)    Unknown 3 41 Median (Q1, Q3); n (%) # Example 2 ---------------------------------- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) |> tbl_svysummary(by = Survived, percent = \"row\", include = c(Class, Age)) |> add_n() Characteristic N No N = 1,4901 Yes N = 7111 Class 2,201     1st 122 (38%) 203 (62%)    2nd 167 (59%) 118 (41%)    3rd 528 (75%) 178 (25%)    Crew 673 (76%) 212 (24%)Age 2,201     Child 52 (48%) 57 (52%)    Adult 1,438 (69%) 654 (31%)1 n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent.tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Add event N — add_nevent.tbl_survfit","title":"Add event N — add_nevent.tbl_survfit","text":"survfit() object summarized tbl_survfit() function add total number events observed new column.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent.tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add event N — add_nevent.tbl_survfit","text":"","code":"# S3 method for class 'tbl_survfit' add_nevent(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent.tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add event N — add_nevent.tbl_survfit","text":"x object class 'tbl_survfit' ... used","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent.tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add event N — add_nevent.tbl_survfit","text":"","code":"library(survival) fit1 <- survfit(Surv(ttdeath, death) ~ 1, trial) fit2 <- survfit(Surv(ttdeath, death) ~ trt, trial) # Example 1 ---------------------------------- list(fit1, fit2) |> tbl_survfit(times = c(12, 24)) |> add_n() |> add_nevent() Characteristic N Event N Time 12 Time 24 Overall 200 112 89% (84%, 93%) 44% (38%, 51%)Chemotherapy Treatment 200 112     Drug A 91% (85%, 97%) 47% (38%, 58%)    Drug B 86% (80%, 93%) 41% (33%, 52%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent_regression.html","id":null,"dir":"Reference","previous_headings":"","what":"Add event N — add_nevent_regression","title":"Add event N — add_nevent_regression","text":"Add event N","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent_regression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add event N — add_nevent_regression","text":"","code":"add_nevent(x, ...) # S3 method for class 'tbl_regression' add_nevent(x, location = \"label\", ...) # S3 method for class 'tbl_uvregression' add_nevent(x, location = \"label\", ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent_regression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add event N — add_nevent_regression","text":"x (tbl_regression, tbl_uvregression) tbl_regression tbl_uvregression table ... dots future extensions must empty. location (character) location place Ns. Select one c('label', 'level'). Default 'label'. \"label\" total Ns placed variable's label row. \"level\" level counts placed variable level categorical variables, total N variable's label row continuous.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_nevent_regression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add event N — add_nevent_regression","text":"","code":"# Example 1 ---------------------------------- trial |> select(response, trt, grade) |> tbl_uvregression( y = response, exponentiate = TRUE, method = glm, method.args = list(family = binomial), ) |> add_nevent() Characteristic N Event N OR 95% CI p-value Chemotherapy Treatment 193 61     Drug A — —     Drug B 1.21 0.66, 2.24 0.5Grade 193 61     I — —     II 0.95 0.45, 2.00 0.9    III 1.10 0.52, 2.29 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio # Example 2 ---------------------------------- glm(response ~ age + grade, trial, family = binomial) |> tbl_regression(exponentiate = TRUE) |> add_nevent(location = \"level\") Characteristic Event N OR 95% CI p-value Age 58 1.02 1.00, 1.04 0.10Grade     I 21 — —     II 17 0.85 0.39, 1.85 0.7    III 20 1.01 0.47, 2.16 >0.9Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":null,"dir":"Reference","previous_headings":"","what":"Add overall column — add_overall","title":"Add overall column — add_overall","text":"Adds column overall summary statistics tables created tbl_summary(), tbl_svysummary(), tbl_continuous() tbl_custom_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add overall column — add_overall","text":"","code":"add_overall(x, ...) # S3 method for class 'tbl_summary' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_continuous' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_svysummary' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_custom_summary' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_hierarchical' add_overall( x, last = FALSE, col_label = \"**Overall** \\nN = {style_number(N)}\", statistic = NULL, digits = NULL, ... ) # S3 method for class 'tbl_hierarchical_count' add_overall( x, last = FALSE, col_label = ifelse(rlang::is_empty(x$inputs$denominator), \"**Overall**\", \"**Overall** \\nN = {style_number(N)}\"), statistic = NULL, digits = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add overall column — add_overall","text":"x (tbl_summary, tbl_svysummary, tbl_continuous, tbl_custom_summary) stratified 'gtsummary' table ... dots future extensions must empty. last (scalar logical) Logical indicator display overall column last table. Default FALSE, display overall column first. col_label (string) String indicating column label. Default \"**Overall** \\nN = {style_number(N)}\" statistic (formula-list-selector) Override statistic argument initial tbl_* function call. Default NULL. digits (formula-list-selector) Override digits argument initial tbl_* function call. Default NULL.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add overall column — add_overall","text":"gtsummary class x","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add overall column — add_overall","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add overall column — add_overall","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(include = c(age, grade), by = trt) |> add_overall() Characteristic Overall N = 2001 Drug A N = 981 Drug B N = 1021 Age 47 (38, 57) 46 (37, 60) 48 (39, 56)    Unknown 11 7 4Grade     I 68 (34%) 35 (36%) 33 (32%)    II 68 (34%) 32 (33%) 36 (35%)    III 64 (32%) 31 (32%) 33 (32%)1 Median (Q1, Q3); n (%) # Example 2 ---------------------------------- trial |> tbl_summary( include = grade, by = trt, percent = \"row\", statistic = ~\"{p}%\", digits = ~1 ) |> add_overall( last = TRUE, statistic = ~\"{p}% (n={n})\", digits = ~ c(1, 0) ) Characteristic Drug A N = 981 Drug B N = 1021 Overall N = 2002 Grade     I 51.5% 48.5% 100.0% (n=68)    II 47.1% 52.9% 100.0% (n=68)    III 48.4% 51.6% 100.0% (n=64)1 % 2 % (n=n) # Example 3 ---------------------------------- trial |> tbl_continuous( variable = age, by = trt, include = grade ) |> add_overall(last = TRUE) Characteristic Drug A N = 981 Drug B N = 1021 Overall N = 2001 Grade     I 46 (36, 60) 48 (42, 55) 47 (37, 56)    II 45 (31, 55) 51 (42, 58) 49 (37, 57)    III 52 (42, 61) 45 (36, 52) 47 (38, 58)1 Age: Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":null,"dir":"Reference","previous_headings":"","what":"ARD add overall column — add_overall_ard","title":"ARD add overall column — add_overall_ard","text":"Adds column overall summary statistics tables created tbl_ard_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ARD add overall column — add_overall_ard","text":"","code":"# S3 method for class 'tbl_ard_summary' add_overall( x, cards, last = FALSE, col_label = \"**Overall**\", statistic = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ARD add overall column — add_overall_ard","text":"x (tbl_ard_summary) stratified 'gtsummary' table cards (card) ARD object class \"card\" typically created cards::ard_*() functions. last (scalar logical) Logical indicator display overall column last table. Default FALSE, display overall column first. col_label (string) String indicating column label. Default \"**Overall**\" statistic (formula-list-selector) Override statistic argument initial tbl_* function call. Default NULL. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ARD add overall column — add_overall_ard","text":"gtsummary class x","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"ARD add overall column — add_overall_ard","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_overall_ard.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ARD add overall column — add_overall_ard","text":"","code":"# Example 1 ---------------------------------- # build primary table tbl <- cards::ard_stack( trial, .by = trt, cards::ard_continuous(variables = age), cards::ard_categorical(variables = grade), .missing = TRUE, .attributes = TRUE, .total_n = TRUE ) |> tbl_ard_summary(by = trt) # create ARD with overall results ard_overall <- cards::ard_stack( trial, cards::ard_continuous(variables = age), cards::ard_categorical(variables = grade), .missing = TRUE, .attributes = TRUE, .total_n = TRUE ) # add an overall column tbl |> add_overall(cards = ard_overall) Characteristic Overall1 Drug A1 Drug B1 Age 47.0 (38.0, 57.0) 46.0 (37.0, 60.0) 48.0 (39.0, 56.0)Grade     I 68 (34.0%) 35 (35.7%) 33 (32.4%)    II 68 (34.0%) 32 (32.7%) 36 (35.3%)    III 64 (32.0%) 31 (31.6%) 33 (32.4%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-values — add_p","title":"Add p-values — add_p","text":"add_p.tbl_summary() add_p.tbl_svysummary() add_p.tbl_continuous() add_p.tbl_cross() add_p.tbl_survfit()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-values — add_p","text":"","code":"add_p(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-values — add_p","text":"x (gtsummary) Object class 'gtsummary' ... Passed methods.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add p-values — add_p","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-values — add_p.tbl_continuous","title":"Add p-values — add_p.tbl_continuous","text":"Add p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-values — add_p.tbl_continuous","text":"","code":"# S3 method for class 'tbl_continuous' add_p( x, test = NULL, pvalue_fun = label_style_pvalue(digits = 1), include = everything(), test.args = NULL, group = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-values — add_p.tbl_continuous","text":"x (tbl_continuous) table created tbl_continuous() test List formulas specifying statistical tests perform variable. Default two-way ANOVA = NULL, defaults add_p.tbl_continuous() = NULL. See tests details, tests, instruction implementing custom test. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). include (tidy-select) Variables include output. Default everything(). test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). group (tidy-select) Variable name ID grouping variable. column can used calculate p-values correlated data. Default NULL. See tests methods utilize group argument. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add p-values — add_p.tbl_continuous","text":"'tbl_continuous' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-values — add_p.tbl_continuous","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_continuous(variable = age, by = trt, include = grade) |> add_p(pvalue_fun = label_style_pvalue(digits = 2)) Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Grade 0.88    I 46 (36, 60) 48 (42, 55)     II 45 (31, 55) 51 (42, 58)     III 52 (42, 61) 45 (36, 52) 1 Age: Median (Q1, Q3) 2 Two-way ANOVA # Example 2 ---------------------------------- trial |> tbl_continuous(variable = age, include = grade) |> add_p(test = everything() ~ \"kruskal.test\") Characteristic N = 2001 p-value2 Grade 0.8    I 47 (37, 56)     II 49 (37, 57)     III 47 (38, 58) 1 Age: Median (Q1, Q3) 2 Kruskal-Wallis rank sum test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-value — add_p.tbl_cross","title":"Add p-value — add_p.tbl_cross","text":"Calculate add p-value comparing two variables cross table. missing levels included tables, also included p-value calculation.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-value — add_p.tbl_cross","text":"","code":"# S3 method for class 'tbl_cross' add_p( x, test = NULL, pvalue_fun = ifelse(source_note, label_style_pvalue(digits = 1, prepend_p = TRUE), label_style_pvalue(digits = 1)), source_note = FALSE, test.args = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-value — add_p.tbl_cross","text":"x (tbl_cross) Object class tbl_cross created tbl_cross() function test (string) string specifying statistical test perform. Default \"chisq.test\" expected cell counts >=5 \"fisher.test\" expected cell counts <5. pvalue_fun (function) Function round format p-value. Default label_style_pvalue(digits = 1), except source_note = TRUE default label_style_pvalue(digits = 1, prepend_p = TRUE) source_note (scalar logical) Logical value indicating whether show p-value {gt} table source notes rather column. test.args (named list) Named list containing additional arguments pass test (accepts additional arguments). example, add argument chi-squared test test.args = list(correct = TRUE) ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add p-value — add_p.tbl_cross","text":"Karissa Whiting, Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-value — add_p.tbl_cross","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_cross(row = stage, col = trt) |> add_p() Chemotherapy Treatment Total p-value1 Drug A Drug B T Stage 0.9    T1 28 25 53     T2 25 29 54     T3 22 21 43     T4 23 27 50 Total 98 102 200 1 Pearson’s Chi-squared test # Example 2 ---------------------------------- trial |> tbl_cross(row = stage, col = trt) |> add_p(source_note = TRUE) Chemotherapy Treatment Total Drug A Drug B T Stage     T1 28 25 53    T2 25 29 54    T3 22 21 43    T4 23 27 50Total 98 102 200Pearson’s Chi-squared test, p=0.9"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-values — add_p.tbl_summary","title":"Add p-values — add_p.tbl_summary","text":"Adds p-values tables created tbl_summary() comparing values across groups.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-values — add_p.tbl_summary","text":"","code":"# S3 method for class 'tbl_summary' add_p( x, test = NULL, pvalue_fun = label_style_pvalue(digits = 1), group = NULL, include = everything(), test.args = NULL, adj.vars = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-values — add_p.tbl_summary","text":"x (tbl_summary) table created tbl_summary() test (formula-list-selector) Specifies statistical tests perform variable, e.g. list(all_continuous() ~ \"t.test\", all_categorical() ~ \"fisher.test\"). See details default tests ?tests details available tests creating custom tests. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). group (tidy-select) Variable name ID grouping variable. column can used calculate p-values correlated data. Default NULL. See tests methods utilize group argument. include (tidy-select) Variables include output. Default everything(). test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). adj.vars (tidy-select) Variables include adjusted calculations (e.g. ANCOVA models). Default NULL. ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add p-values — add_p.tbl_summary","text":"gtsummary table class \"tbl_summary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"test-argument","dir":"Reference","previous_headings":"","what":"test argument","title":"Add p-values — add_p.tbl_summary","text":"See ?tests help file details available tests creating custom tests. ?tests help file also includes pseudo-code test clear precisely calculation performed. default test used add_p() primarily depends factors: whether variable categorical/dichotomous vs continuous number levels tbl_summary() variable whether add_p(group) argument specified whether add_p(adj.vars) argument specified","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"specified-neither-add-p-group-nor-add-p-adj-vars-","dir":"Reference","previous_headings":"","what":"Specified neither add_p(group) nor add_p(adj.vars)","title":"Add p-values — add_p.tbl_summary","text":"\"wilcox.test\" variable two levels variable continuous. \"kruskal.test\" variable two levels variable continuous. \"chisq.test..correct\" categorical variables expected cell counts >=5, \"fisher.test\" categorical variables expected cell count <5.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"specified-add-p-group-and-not-add-p-adj-vars-","dir":"Reference","previous_headings":"","what":"Specified add_p(group) and not add_p(adj.vars)","title":"Add p-values — add_p.tbl_summary","text":"\"lme4\" variable two levels summary types. default grouped data variable two levels. Users must create custom tests scenario.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"specified-add-p-adj-vars-and-not-add-p-group-","dir":"Reference","previous_headings":"","what":"Specified add_p(adj.vars) and not add_p(group)","title":"Add p-values — add_p.tbl_summary","text":"\"ancova\" variable continuous variable two levels.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-values — add_p.tbl_summary","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(age, grade)) |> add_p() Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Age 46 (37, 60) 48 (39, 56) 0.7    Unknown 7 4 Grade 0.9    I 35 (36%) 33 (32%)     II 32 (33%) 36 (35%)     III 31 (32%) 33 (32%) 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test; Pearson’s Chi-squared test # Example 2 ---------------------------------- trial |> select(trt, age, marker) |> tbl_summary(by = trt, missing = \"no\") |> add_p( # perform t-test for all variables test = everything() ~ \"t.test\", # assume equal variance in the t-test test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE) ) Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Age 46 (37, 60) 48 (39, 56) 0.8Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) 0.121 Median (Q1, Q3) 2 Two Sample t-test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-value — add_p.tbl_survfit","title":"Add p-value — add_p.tbl_survfit","text":"Calculate add p-value stratified tbl_survfit() tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-value — add_p.tbl_survfit","text":"","code":"# S3 method for class 'tbl_survfit' add_p( x, test = \"logrank\", test.args = NULL, pvalue_fun = label_style_pvalue(digits = 1), include = everything(), quiet, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-value — add_p.tbl_survfit","text":"x (tbl_survfit) Object class \"tbl_survfit\" test (string) string indicating test use. Must one \"logrank\", \"tarone\", \"survdiff\", \"petopeto_gehanwilcoxon\", \"coxph_lrt\", \"coxph_wald\", \"coxph_score\". See details test.args (named list) named list arguments passed method specified test argument. Default NULL. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). include (tidy-select) Variables include output. Default everything(). quiet ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"test-argument","dir":"Reference","previous_headings":"","what":"test argument","title":"Add p-value — add_p.tbl_survfit","text":"common way specify test= using single string indicating test name. However, need specify different tests within table, input flexible using list notation common throughout gtsummary package. example, following code call log-rank test, second test G-rho family.","code":"... |> add_p(test = list(trt ~ \"logrank\", grade ~ \"survdiff\"), test.args = grade ~ list(rho = 0.5))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Add p-value — add_p.tbl_survfit","text":"calculate p-values, formula re-constructed call original survfit() object. survfit() object created loop, lapply(), purrr::map() setting call may reflect true formula may result error incorrect calculation. ensure correct results, call formula survfit() must represent formula used survival::survdiff(). utilize tbl_survfit.data.frame() S3 method, handled .","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-value — add_p.tbl_survfit","text":"","code":"library(survival) gts_survfit <- list( survfit(Surv(ttdeath, death) ~ grade, trial), survfit(Surv(ttdeath, death) ~ trt, trial) ) |> tbl_survfit(times = c(12, 24)) # Example 1 ---------------------------------- gts_survfit |> add_p() Characteristic Time 12 Time 24 p-value1 Grade 0.072    I 97% (93%, 100%) 51% (41%, 65%)     II 82% (74%, 92%) 47% (37%, 61%)     III 86% (78%, 95%) 33% (23%, 47%) Chemotherapy Treatment 0.2    Drug A 91% (85%, 97%) 47% (38%, 58%)     Drug B 86% (80%, 93%) 41% (33%, 52%) 1 Log-rank test # Example 2 ---------------------------------- # Pass `rho=` argument to `survdiff()` gts_survfit |> add_p(test = \"survdiff\", test.args = list(rho = 0.5)) Characteristic Time 12 Time 24 p-value1 Grade 0.070    I 97% (93%, 100%) 51% (41%, 65%)     II 82% (74%, 92%) 47% (37%, 61%)     III 86% (78%, 95%) 33% (23%, 47%) Chemotherapy Treatment 0.2    Drug A 91% (85%, 97%) 47% (38%, 58%)     Drug B 86% (80%, 93%) 41% (33%, 52%) 1 G-rho test (ρ = 0.5)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Add p-values — add_p.tbl_svysummary","title":"Add p-values — add_p.tbl_svysummary","text":"Adds p-values tables created tbl_svysummary() comparing values across groups.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add p-values — add_p.tbl_svysummary","text":"","code":"# S3 method for class 'tbl_svysummary' add_p( x, test = list(all_continuous() ~ \"svy.wilcox.test\", all_categorical() ~ \"svy.chisq.test\"), pvalue_fun = label_style_pvalue(digits = 1), include = everything(), test.args = NULL, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add p-values — add_p.tbl_svysummary","text":"x (tbl_svysummary) table created tbl_svysummary() test (formula-list-selector) List formulas specifying statistical tests perform. Default list(all_continuous() ~ \"svy.wilcox.test\", all_categorical() ~ \"svy.chisq.test\"). See details default tests ?tests details available tests creating custom tests. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). include (tidy-select) Variables include output. Default everything(). test.args (formula-list-selector) Containing additional arguments pass tests accept arguments. example, add argument t-tests, use test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add p-values — add_p.tbl_svysummary","text":"gtsummary table class \"tbl_svysummary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_p.tbl_svysummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add p-values — add_p.tbl_svysummary","text":"","code":"# Example 1 ---------------------------------- # A simple weighted dataset survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) |> tbl_svysummary(by = Survived, include = c(Sex, Age)) |> add_p() #> The following warnings were returned during `add_p()`: #> ! For variable `Age` (`Survived`) and \"statistic\" and \"p.value\" statistics: #> Chi-squared approximation may be incorrect #> ! For variable `Sex` (`Survived`) and \"statistic\" and \"p.value\" statistics: #> Chi-squared approximation may be incorrect Characteristic No N = 1,4901 Yes N = 7111 p-value2 Sex 0.048    Male 1,364 (92%) 367 (52%)     Female 126 (8.5%) 344 (48%) Age 0.4    Child 52 (3.5%) 57 (8.0%)     Adult 1,438 (97%) 654 (92%) 1 n (%) 2 Pearson’s X^2: Rao & Scott adjustment # A dataset with a complex design data(api, package = \"survey\") d_clust <- survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) # Example 2 ---------------------------------- tbl_svysummary(d_clust, by = both, include = c(api00, api99)) |> add_p() Characteristic No N = 1,6921 Yes N = 4,5021 p-value2 api00 631 (559, 710) 655 (551, 723) 0.4api99 632 (550, 701) 613 (499, 687) 0.21 Median (Q1, Q3) 2 Design-based KruskalWallis test # Example 3 ---------------------------------- # change tests to svy t-test and Wald test tbl_svysummary(d_clust, by = both, include = c(api00, api99, stype)) |> add_p( test = list( all_continuous() ~ \"svy.t.test\", all_categorical() ~ \"svy.wald.test\" ) ) Characteristic No N = 1,6921 Yes N = 4,5021 p-value2 api00 631 (559, 710) 655 (551, 723) 0.4api99 632 (550, 701) 613 (499, 687) 0.2stype 0.049    E 1,083 (64%) 3,791 (84%)     H 237 (14%) 237 (5.3%)     M 372 (22%) 474 (11%) 1 Median (Q1, Q3); n (%) 2 Design-based t-test; Design-based Wald test of association"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":null,"dir":"Reference","previous_headings":"","what":"Add multiple comparison adjustment — add_q","title":"Add multiple comparison adjustment — add_q","text":"Adjustments p-values performed stats::p.adjust().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add multiple comparison adjustment — add_q","text":"","code":"add_q(x, method = \"fdr\", pvalue_fun = NULL, quiet = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add multiple comparison adjustment — add_q","text":"x (gtsummary) gtsummary object column named \"p.value\" method (string) String indicating method used p-value adjustment. Methods stats::p.adjust() accepted. Default method='fdr'. Must one 'holm', 'hochberg', 'hommel', 'bonferroni', 'BH', '', 'fdr', 'none' pvalue_fun (function) Function round format q-values. Default function specified round existing 'p.value' column. quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add multiple comparison adjustment — add_q","text":"Daniel D. Sjoberg, Esther Drill","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_q.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add multiple comparison adjustment — add_q","text":"","code":"# Example 1 ---------------------------------- add_q_ex1 <- trial |> tbl_summary(by = trt, include = c(trt, age, grade, response)) |> add_p() |> add_q() # Example 2 ---------------------------------- trial |> tbl_uvregression( y = response, include = c(\"trt\", \"age\", \"grade\"), method = glm, method.args = list(family = binomial), exponentiate = TRUE ) |> add_global_p() |> add_q() Characteristic N OR 95% CI p-value q-value1 Chemotherapy Treatment 193 0.5 0.8    Drug A — —     Drug B 1.21 0.66, 2.24 Age 183 1.02 1.00, 1.04 0.091 0.3Grade 193 >0.9 >0.9    I — —     II 0.95 0.45, 2.00     III 1.10 0.52, 2.29 Abbreviations: CI = Confidence Interval, OR = Odds Ratio 1 False discovery rate correction for multiple testing"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":null,"dir":"Reference","previous_headings":"","what":"Add significance stars — add_significance_stars","title":"Add significance stars — add_significance_stars","text":"Add significance stars estimates small p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add significance stars — add_significance_stars","text":"","code":"add_significance_stars( x, pattern = ifelse(inherits(x, c(\"tbl_regression\", \"tbl_uvregression\")), \"{estimate}{stars}\", \"{p.value}{stars}\"), thresholds = c(0.001, 0.01, 0.05), hide_ci = TRUE, hide_p = inherits(x, c(\"tbl_regression\", \"tbl_uvregression\")), hide_se = FALSE )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add significance stars — add_significance_stars","text":"x (gtsummary) 'gtsummary' object 'p.value' column pattern (string) glue-syntax string indicating display formatted column. Default \"{estimate}{stars}\" regression summaries \"{p.value}{stars}\" otherwise. footnote placed first column listed pattern. common patterns \"{estimate}{stars} ({conf.low}, {conf.high})\" \"{estimate} ({conf.low} {conf.high}){stars}\" thresholds (numeric) Thresholds significance stars. Default c(0.001, 0.01, 0.05) hide_ci (scalar logical) logical whether hide confidence interval. Default TRUE hide_p (scalar logical) logical whether hide p-value. Default TRUE regression summaries, FALSE otherwise. hide_se (scalar logical) logical whether hide standard error. Default FALSE","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add significance stars — add_significance_stars","text":"'gtsummary' table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_significance_stars.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add significance stars — add_significance_stars","text":"","code":"tbl <- lm(time ~ ph.ecog + sex, survival::lung) |> tbl_regression(label = list(ph.ecog = \"ECOG Score\", sex = \"Sex\")) # Example 1 ---------------------------------- tbl |> add_significance_stars(hide_ci = FALSE, hide_p = FALSE) Characteristic Beta1 SE 95% CI p-value ECOG Score -58** 19.1 -96, -21 0.003Sex 52 27.9 -2.5, 107 0.061Abbreviations: CI = Confidence Interval, SE = Standard Error 1 *p<0.05; **p<0.01; ***p<0.001 # Example 2 ---------------------------------- tbl |> add_significance_stars( pattern = \"{estimate} ({conf.low}, {conf.high}){stars}\", hide_ci = TRUE, hide_se = TRUE ) |> modify_header(estimate = \"**Beta (95% CI)**\") |> modify_abbreviation(\"CI = Confidence Interval\") Characteristic Beta (95% CI)1 ECOG Score -58 (-96, -21)**Sex 52 (-2.5, 107)Abbreviation: CI = Confidence Interval 1 *p<0.05; **p<0.01; ***p<0.001 # Example 3 ---------------------------------- # Use ' \\n' to put a line break between beta and SE tbl |> add_significance_stars( hide_se = TRUE, pattern = \"{estimate}{stars} \\n({std.error})\" ) |> modify_header(estimate = \"**Beta \\n(SE)**\") |> modify_abbreviation(\"SE = Standard Error\") |> as_gt() |> gt::fmt_markdown(columns = everything()) |> gt::tab_style( style = \"vertical-align:top\", locations = gt::cells_body(columns = label) ) Characteristic Beta (SE)1 ECOG Score -58.1552930554511** (19.0504299286733)Sex 52.4310811827553 (27.8957178715894)Abbreviations: CI = Confidence Interval, SE = Standard Error 1 *p<0.05; **p<0.01; ***p<0.001 # Example 4 ---------------------------------- lm(marker ~ stage + grade, data = trial) |> tbl_regression() |> add_global_p() |> add_significance_stars( hide_p = FALSE, pattern = \"{p.value}{stars}\" ) Characteristic Beta SE p-value1 T Stage 0.2    T1 — —     T2 0.36 0.168     T3 0.23 0.183     T4 0.13 0.171 Grade 0.047*    I — —     II -0.36 0.150     III -0.08 0.150 Abbreviations: CI = Confidence Interval, SE = Standard Error 1 *p<0.05; **p<0.01; ***p<0.001"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":null,"dir":"Reference","previous_headings":"","what":"Add a custom statistic — add_stat","title":"Add a custom statistic — add_stat","text":"function allows user add new column (columns) statistics existing tbl_summary, tbl_svysummary, tbl_continuous object.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add a custom statistic — add_stat","text":"","code":"add_stat(x, fns, location = everything() ~ \"label\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add a custom statistic — add_stat","text":"x (tbl_summary/tbl_svysummary/tbl_continuous) gtsummary table class 'tbl_summary', 'tbl_svysummary', 'tbl_continuous'. fns (formula-list-selector) Indicates functions create statistic. See details . location (formula-list-selector) Indicates location new statistics placed. values must one c(\"label\", \"level\", \"missing\"). \"label\", single statistic placed variable label row. \"level\" statistics placed variable level rows. length vector statistics returned fns function must match dimension levels. Default place new statistics label row.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add a custom statistic — add_stat","text":"'gtsummary' class input","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Add a custom statistic — add_stat","text":"returns custom functions passed fns= required follow specified format. function execute single variable. function must return tibble vector. vector returned, converted tibble one column number rows equal length vector. location='label', returned statistic custom function must tibble one row. location='level' tibble must number rows levels variable (excluding row unknown values). function may take following arguments: foo(data, variable, , tbl, ...) data= input data frame passed tbl_summary() variable= string indicating variable perform calculation . variable label column table. = string indicating variable tbl_summary=, present tbl= original tbl_summary()/tbl_svysummary() object also available utilize user-defined function need utilize inputs. encouraged user-defined function accept ... arguments passed function, even inputs utilized user's function, e.g. foo(data, variable, , ...) Use modify_header() update column headers Use modify_fmt_fun() update functions format statistics Use modify_footnote_header() add explanatory footnote return tibble column names p.value q.value, default p-value formatting applied, may take advantage subsequent p-value formatting functions, bold_p() add_q().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add a custom statistic — add_stat","text":"","code":"# Example 1 ---------------------------------- # fn returns t-test pvalue my_ttest <- function(data, variable, by, ...) { t.test(data[[variable]] ~ as.factor(data[[by]]))$p.value } trial |> tbl_summary( by = trt, include = c(trt, age, marker), missing = \"no\" ) |> add_stat(fns = everything() ~ my_ttest) |> modify_header(add_stat_1 = \"**p-value**\", all_stat_cols() ~ \"**{level}**\") Characteristic Drug A1 Drug B1 p-value Age 46 (37, 60) 48 (39, 56) 0.834Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) 0.1161 Median (Q1, Q3) # Example 2 ---------------------------------- # fn returns t-test test statistic and pvalue my_ttest2 <- function(data, variable, by, ...) { t.test(data[[variable]] ~ as.factor(data[[by]])) |> broom::tidy() %>% dplyr::mutate( stat = glue::glue(\"t={style_sigfig(statistic)}, {style_pvalue(p.value, prepend_p = TRUE)}\") ) %>% dplyr::pull(stat) } trial |> tbl_summary( by = trt, include = c(trt, age, marker), missing = \"no\" ) |> add_stat(fns = everything() ~ my_ttest2) |> modify_header(add_stat_1 = \"**Treatment Comparison**\") Characteristic Drug A N = 981 Drug B N = 1021 Treatment Comparison Age 46 (37, 60) 48 (39, 56) t=-0.21, p=0.8Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) t=1.6, p=0.121 Median (Q1, Q3) # Example 3 ---------------------------------- # return test statistic and p-value is separate columns my_ttest3 <- function(data, variable, by, ...) { t.test(data[[variable]] ~ as.factor(data[[by]])) %>% broom::tidy() %>% select(statistic, p.value) } trial |> tbl_summary( by = trt, include = c(trt, age, marker), missing = \"no\" ) |> add_stat(fns = everything() ~ my_ttest3) |> modify_header(statistic = \"**t-statistic**\", p.value = \"**p-value**\") |> modify_fmt_fun(statistic = label_style_sigfig(), p.value = label_style_pvalue(digits = 2)) Characteristic Drug A N = 981 Drug B N = 1021 t-statistic p-value Age 46 (37, 60) 48 (39, 56) -0.21 0.83Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) 1.6 0.121 Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":null,"dir":"Reference","previous_headings":"","what":"Add statistic labels — add_stat_label","title":"Add statistic labels — add_stat_label","text":"Adds modifies labels describing summary statistics presented variable tbl_summary() table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add statistic labels — add_stat_label","text":"","code":"add_stat_label(x, ...) # S3 method for class 'tbl_summary' add_stat_label(x, location = c(\"row\", \"column\"), label = NULL, ...) # S3 method for class 'tbl_svysummary' add_stat_label(x, location = c(\"row\", \"column\"), label = NULL, ...) # S3 method for class 'tbl_ard_summary' add_stat_label(x, location = c(\"row\", \"column\"), label = NULL, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add statistic labels — add_stat_label","text":"x (tbl_summary) Object class 'tbl_summary' class 'tbl_svysummary' ... dots future extensions must empty. location (string) Location statistic label included. \"row\" (default) add statistic label variable label row, \"column\" adds column statistic label. label (formula-list-selector) indicates updates statistic label, e.g. label = all_categorical() ~ \". (%)\". specified, default statistic labels used.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Add statistic labels — add_stat_label","text":"tbl_summary tbl_svysummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"tips","dir":"Reference","previous_headings":"","what":"Tips","title":"Add statistic labels — add_stat_label","text":"using add_stat_label(location='row') subsequent tbl_merge(), important somewhat understanding underlying structure gtsummary table. add_stat_label(location='row') works adding new column called \"stat_label\" x$table_body. \"label\" \"stat_label\" columns merged gtsummary table printed. tbl_merge() function merges \"label\" column (among others), typically first column see gtsummary table. Therefore, want merge table run add_stat_label(location='row') need match \"label\" column values \"stat_column\" merged . example, following two tables merge properly addition new \"stat_label\" column requires default labels categorical variables, \". (%)\". can changed either desired text left blank using NA_character_. blank option useful location=\"row\" case keep output categorical variables identical produced without \"add_stat_label()\" function call.","code":"tbl1 <- trial %>% select(age, grade) |> tbl_summary() |> add_stat_label() tbl2 <- lm(marker ~ age + grade, trial) |> tbl_regression() tbl_merge(list(tbl1, tbl2))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Add statistic labels — add_stat_label","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_stat_label.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add statistic labels — add_stat_label","text":"","code":"tbl <- trial |> dplyr::select(trt, age, grade, response) |> tbl_summary(by = trt) # Example 1 ---------------------------------- # Add statistic presented to the variable label row tbl |> add_stat_label( # update default statistic label for continuous variables label = all_continuous() ~ \"med. (iqr)\" ) Characteristic Drug A N = 98 Drug B N = 102 Age, med. (iqr) 46 (37, 60) 48 (39, 56)    Unknown 7 4Grade, n (%)     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)Tumor Response, n (%) 28 (29%) 33 (34%)    Unknown 3 4 # Example 2 ---------------------------------- tbl |> add_stat_label( # add a new column with statistic labels location = \"column\" ) Characteristic Statistic Drug A N = 98 Drug B N = 102 Age Median (Q1, Q3) 46 (37, 60) 48 (39, 56)    Unknown n 7 4Grade     I n (%) 35 (36%) 33 (32%)    II n (%) 32 (33%) 36 (35%)    III n (%) 31 (32%) 33 (32%)Tumor Response n (%) 28 (29%) 33 (34%)    Unknown n 3 4 # Example 3 ---------------------------------- trial |> select(age, grade, trt) |> tbl_summary( by = trt, type = all_continuous() ~ \"continuous2\", statistic = all_continuous() ~ c(\"{median} ({p25}, {p75})\", \"{min} - {max}\"), ) |> add_stat_label(label = age ~ c(\"IQR\", \"Range\")) Characteristic Drug A N = 98 Drug B N = 102 Age     IQR 46 (37, 60) 48 (39, 56)    Range 6 - 78 9 - 83    Unknown 7 4Grade, n (%)     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_vif.html","id":null,"dir":"Reference","previous_headings":"","what":"Add Variance Inflation Factor — add_vif","title":"Add Variance Inflation Factor — add_vif","text":"Add variance inflation factor (VIF) generalized VIF (GVIF) regression table. Function uses car::vif() calculate VIF.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_vif.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Add Variance Inflation Factor — add_vif","text":"","code":"add_vif(x, statistic = NULL, estimate_fun = label_style_sigfig(digits = 2))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_vif.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Add Variance Inflation Factor — add_vif","text":"x 'tbl_regression' object statistic \"VIF\" (variance inflation factors, models categorical terms) one /combination \"GVIF\" (generalized variance inflation factors), \"aGVIF\" 'adjusted GVIF, .e. GVIF^[1/(2*df)] /\"df\" (degrees freedom). See car::vif() details. estimate_fun Default label_style_sigfig(digits = 2).","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/add_vif.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Add Variance Inflation Factor — add_vif","text":"","code":"# Example 1 ---------------------------------- lm(age ~ grade + marker, trial) |> tbl_regression() |> add_vif() Characteristic Beta 95% CI p-value GVIF Adjusted GVIF1 Grade 1.0 1.0    I — —     II 0.64 -4.7, 6.0 0.8     III 2.4 -2.8, 7.6 0.4 Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9 1.0 1.0Abbreviations: CI = Confidence Interval, GVIF = Generalized Variance Inflation Factor 1 GVIF^[1/(2*df)] # Example 2 ---------------------------------- lm(age ~ grade + marker, trial) |> tbl_regression() |> add_vif(c(\"aGVIF\", \"df\")) Characteristic Beta 95% CI p-value Adjusted GVIF1 df Grade 1.0 2    I — —     II 0.64 -4.7, 6.0 0.8     III 2.4 -2.8, 7.6 0.4 Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9 1.0 1Abbreviations: CI = Confidence Interval, GVIF = Generalized Variance Inflation Factor, df = degrees of freedom 1 GVIF^[1/(2*df)]"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a flextable object — as_flex_table","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"Function converts gtsummary object flextable object. user can use function wish add customized formatting available via flextable functions. flextable output particularly useful combined R markdown Word output, since gt package support Word.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"","code":"as_flex_table(x, include = everything(), return_calls = FALSE, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"x (gtsummary) object class `\"gtsummary\" include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). return_calls Logical. Default FALSE. TRUE, calls returned list expressions. ... used","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"'flextable' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"as_flex_table() function supports bold italic markdown syntax column headers spanning headers ('**' '_' ). Text wrapped double stars ('**bold**') made bold, text single underscores ('_italic_') made italic. markdown syntax supported double-star underscore combined. style table, may convert table flextable as_flex_table(), utilize flextable functions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_flex_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a flextable object — as_flex_table","text":"Characteristic Drug N = 981 Drug B N = 1021 p-value2 Age 46 (37, 60) 48 (39, 56) 0.7 Unknown 7 4 Grade 0.9 35 (36%) 33 (32%) II 32 (33%) 36 (35%) III 31 (32%) 33 (32%) 1Median (Q1, Q3); n (%) 2Wilcoxon rank sum test; Pearson's Chi-squared test","code":"trial |> select(trt, age, grade) |> tbl_summary(by = trt) |> add_p() |> as_flex_table() .cl-a6e3fd7e{}.cl-a6dde826{font-family:'DejaVu Sans';font-size:11pt;font-weight:bold;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;}.cl-a6dde83a{font-family:'DejaVu Sans';font-size:11pt;font-weight:normal;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;}.cl-a6dde83b{font-family:'DejaVu Sans';font-size:6.6pt;font-weight:normal;font-style:normal;text-decoration:none;color:rgba(0, 0, 0, 1.00);background-color:transparent;position: relative;bottom:3.3pt;}.cl-a6e06d94{margin:0;text-align:left;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:2pt;padding-top:2pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-a6e06d9e{margin:0;text-align:center;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:2pt;padding-top:2pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-a6e06da8{margin:0;text-align:left;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-a6e06da9{margin:0;text-align:center;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-a6e06db2{margin:0;text-align:left;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:15pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-a6e06dbc{margin:0;text-align:left;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);padding-bottom:5pt;padding-top:5pt;padding-left:5pt;padding-right:5pt;line-height: 1;background-color:transparent;}.cl-a6e08ac2{width:1.489in;background-color:transparent;vertical-align: middle;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 1pt solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08acc{width:1.133in;background-color:transparent;vertical-align: middle;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 1pt solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08acd{width:0.925in;background-color:transparent;vertical-align: middle;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 1pt solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08ad6{width:1.489in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08ad7{width:1.133in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08ae0{width:0.925in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08ae1{width:1.489in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08ae2{width:1.133in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08aea{width:0.925in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08aeb{width:1.489in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08af4{width:1.133in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08af5{width:0.925in;background-color:transparent;vertical-align: top;border-bottom: 0 solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08af6{width:1.489in;background-color:transparent;vertical-align: top;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08afe{width:1.133in;background-color:transparent;vertical-align: top;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08aff{width:0.925in;background-color:transparent;vertical-align: top;border-bottom: 1pt solid rgba(0, 0, 0, 1.00);border-top: 0 solid rgba(0, 0, 0, 1.00);border-left: 0 solid rgba(0, 0, 0, 1.00);border-right: 0 solid rgba(0, 0, 0, 1.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08b08{width:1.489in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(255, 255, 255, 0.00);border-top: 0 solid rgba(255, 255, 255, 0.00);border-left: 0 solid rgba(255, 255, 255, 0.00);border-right: 0 solid rgba(255, 255, 255, 0.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08b09{width:1.133in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(255, 255, 255, 0.00);border-top: 0 solid rgba(255, 255, 255, 0.00);border-left: 0 solid rgba(255, 255, 255, 0.00);border-right: 0 solid rgba(255, 255, 255, 0.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}.cl-a6e08b0a{width:0.925in;background-color:transparent;vertical-align: middle;border-bottom: 0 solid rgba(255, 255, 255, 0.00);border-top: 0 solid rgba(255, 255, 255, 0.00);border-left: 0 solid rgba(255, 255, 255, 0.00);border-right: 0 solid rgba(255, 255, 255, 0.00);margin-bottom:0;margin-top:0;margin-left:0;margin-right:0;}CharacteristicDrug A N = 981Drug B N = 1021p-value2Age46 (37, 60)48 (39, 56)0.7Unknown74Grade0.9I35 (36%)33 (32%)II32 (33%)36 (35%)III31 (32%)33 (32%)1Median (Q1, Q3); n (%)2Wilcoxon rank sum test; Pearson's Chi-squared test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to gt — as_gt","title":"Convert gtsummary object to gt — as_gt","text":"Function converts gtsummary object \"gt_tbl\" object, , table created gt::gt(). Function used background results printed knit. user can use function wish add customized formatting available via gt package.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to gt — as_gt","text":"","code":"as_gt(x, include = everything(), return_calls = FALSE, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to gt — as_gt","text":"x (gtsummary) object class `\"gtsummary\" include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). return_calls Logical. Default FALSE. TRUE, calls returned list expressions. ... Arguments passed gt::gt(...)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to gt — as_gt","text":"gt_tbl object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Convert gtsummary object to gt — as_gt","text":"2024-08-15, line breaks (e.g. '\\n') render properly PDF output. now, line breaks stripped rendering PDF Quarto R markdown.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to gt — as_gt","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_gt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to gt — as_gt","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(age, grade, response)) |> as_gt() Characteristic Drug A N = 981 Drug B N = 1021 Age 46 (37, 60) 48 (39, 56)    Unknown 7 4Grade     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)Tumor Response 28 (29%) 33 (34%)    Unknown 3 41 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a huxtable object — as_hux_table","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"Function converts gtsummary object huxtable object. user can use function wish add customized formatting available via huxtable functions. huxtable package supports output PDF via LaTeX, well HTML Word.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"","code":"as_hux_table( x, include = everything(), return_calls = FALSE, strip_md_bold = FALSE ) as_hux_xlsx(x, file, include = everything(), bold_header_rows = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"x (gtsummary) object class `\"gtsummary\" include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). return_calls Logical. Default FALSE. TRUE, calls returned list expressions. strip_md_bold file File path output. bold_header_rows (scalar logical) logical indicating whether bold header rows. Default TRUE","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"{huxtable} object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"excel-output","dir":"Reference","previous_headings":"","what":"Excel Output","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"Use as_hux_xlsx() function save copy table excel file. file saved using huxtable::quick_xlsx().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"David Hugh-Jones, Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_hux_table.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a huxtable object — as_hux_table","text":"","code":"trial |> tbl_summary(by = trt, include = c(age, grade)) |> add_p() |> as_hux_table() #> Characteristic Drug AN = 98 Drug BN = 102 p-value #> ─────────────────────────────────────────────────────────── #> Age 46 (37, 60) 48 (39, 56) 0.7 #> Unknown 7 4 #> Grade 0.9 #> I 35 (36%) 33 (32%) #> II 32 (33%) 36 (35%) #> III 31 (32%) 33 (32%) #> ─────────────────────────────────────────────────────────── #> Median (Q1, Q3); n (%) #> Wilcoxon rank sum test; Pearson's Chi-squared #> test #> #> Column names: label, stat_1, stat_2, p.value"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a kable object — as_kable","title":"Convert gtsummary object to a kable object — as_kable","text":"Output knitr::kable() less full featured compared summary tables produced gt. example, kable summary tables include indentation, footnotes, spanning header rows. Line breaks (\\n) removed column headers table cells.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a kable object — as_kable","text":"","code":"as_kable(x, ..., include = everything(), return_calls = FALSE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a kable object — as_kable","text":"x (gtsummary) Object created function gtsummary package (e.g. tbl_summary tbl_regression) ... Additional arguments passed knitr::kable() include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). return_calls Logical. Default FALSE. TRUE, calls returned list expressions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a kable object — as_kable","text":"knitr_kable object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert gtsummary object to a kable object — as_kable","text":"Tip: better distinguish variable labels level labels indenting supported, try bold_labels() italicize_levels().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a kable object — as_kable","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a kable object — as_kable","text":"","code":"trial |> tbl_summary(by = trt) |> bold_labels() |> as_kable() #> #> #> |**Characteristic** | **Drug A** N = 98 | **Drug B** N = 102 | #> |:--------------------------|:------------------:|:-------------------:| #> |__Age__ | 46 (37, 60) | 48 (39, 56) | #> |Unknown | 7 | 4 | #> |__Marker Level (ng/mL)__ | 0.84 (0.23, 1.60) | 0.52 (0.18, 1.21) | #> |Unknown | 6 | 4 | #> |__T Stage__ | | | #> |T1 | 28 (29%) | 25 (25%) | #> |T2 | 25 (26%) | 29 (28%) | #> |T3 | 22 (22%) | 21 (21%) | #> |T4 | 23 (23%) | 27 (26%) | #> |__Grade__ | | | #> |I | 35 (36%) | 33 (32%) | #> |II | 32 (33%) | 36 (35%) | #> |III | 31 (32%) | 33 (32%) | #> |__Tumor Response__ | 28 (29%) | 33 (34%) | #> |Unknown | 3 | 4 | #> |__Patient Died__ | 52 (53%) | 60 (59%) | #> |__Months to Death/Censor__ | 23.5 (17.4, 24.0) | 21.2 (14.5, 24.0) |"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a kableExtra object — as_kable_extra","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"Function converts gtsummary object knitr_kable + kableExtra object. allows customized formatting available via knitr::kable() {kableExtra}; as_kable_extra() supports arguments knitr::kable(). as_kable_extra() output via gtsummary supports bold italic cells table bodies. Users encouraged leverage as_kable_extra() enhanced pdf printing; html output options better support via as_gt().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"","code":"as_kable_extra( x, escape = FALSE, format = NULL, ..., include = everything(), addtl_fmt = TRUE, return_calls = FALSE )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"x (gtsummary) Object created function gtsummary package (e.g. tbl_summary tbl_regression) format, escape, ... arguments passed knitr::kable(). Default escape = FALSE, format auto-detected. include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). addtl_fmt logical indicating whether include additional formatting. Default TRUE. primarily used escape special characters, convert markdown LaTeX, remove line breaks footnote. return_calls Logical. Default FALSE. TRUE, calls returned list expressions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"{kableExtra} table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"pdf-latex","dir":"Reference","previous_headings":"","what":"PDF/LaTeX","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"section shows options intended use output: pdf_document yaml .Rmd. default values as_kable_extra(escape = FALSE, addtl_fmt = TRUE) utilized, following formatting occurs. Markdown bold, italic, underline syntax headers, spanning headers, caption, footnote converted escaped LaTeX code Special characters table body, headers, spanning headers, caption, footnote escaped .escape_latex() .escape_latex2() \"\\n\" symbol recognized line break table headers, spanning headers, caption, table body \"\\n\" symbol removed footnotes suppress additional formats, set as_kable_extra(addtl_fmt = FALSE) Additional styling available kableExtra::kable_styling() shown Example 2, implements row striping repeated column headers presence page breaks.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"html","dir":"Reference","previous_headings":"","what":"HTML","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"section discusses options intended use output: html_document yaml .Rmd. default values as_kable_extra(escape = FALSE, addtl_fmt = TRUE) utilized, following formatting occurs. default markdown syntax headers spanning headers removed Special characters table body, headers, spanning headers, caption, footnote escaped .escape_html() \"\\n\" symbol removed footnotes suppress additional formatting, set as_kable_extra(addtl_fmt = FALSE)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_kable_extra.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a kableExtra object — as_kable_extra","text":"","code":"# basic gtsummary tbl to build upon as_kable_extra_base <- trial |> tbl_summary(by = trt, include = c(age, stage)) |> bold_labels() # Example 1 (PDF via LaTeX) --------------------- # add linebreak in table header with '\\n' as_kable_extra_ex1_pdf <- as_kable_extra_base |> modify_header(all_stat_cols() ~ \"**{level}** \\n*N = {n}*\") |> as_kable_extra() # Example 2 (PDF via LaTeX) --------------------- # additional styling in `knitr::kable()` and with # call to `kableExtra::kable_styling()` as_kable_extra_ex2_pdf <- as_kable_extra_base |> as_kable_extra( booktabs = TRUE, longtable = TRUE, linesep = \"\" ) |> kableExtra::kable_styling( position = \"left\", latex_options = c(\"striped\", \"repeat_header\"), stripe_color = \"gray!15\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert gtsummary object to a tibble — as_tibble.gtsummary","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"Function converts gtsummary object tibble.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"","code":"# S3 method for class 'gtsummary' as_tibble( x, include = everything(), col_labels = TRUE, return_calls = FALSE, fmt_missing = FALSE, ... ) # S3 method for class 'gtsummary' as.data.frame(...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"x (gtsummary) object class `\"gtsummary\" include Commands include output. Input may vector quoted unquoted names. tidyselect gtsummary select helper functions also accepted. Default everything(). col_labels (scalar logical) Logical argument adding column labels output tibble. Default TRUE. return_calls Logical. Default FALSE. TRUE, calls returned list expressions. fmt_missing (scalar logical) Logical argument adding missing value formats. ... Arguments passed gt::gt(...)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"tibble","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/as_tibble.gtsummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert gtsummary object to a tibble — as_tibble.gtsummary","text":"","code":"tbl <- trial |> tbl_summary(by = trt, include = c(age, grade, response)) as_tibble(tbl) #> # A tibble: 8 × 3 #> `**Characteristic**` `**Drug A** \\nN = 98` `**Drug B** \\nN = 102` #> #> 1 Age 46 (37, 60) 48 (39, 56) #> 2 Unknown 7 4 #> 3 Grade NA NA #> 4 I 35 (36%) 33 (32%) #> 5 II 32 (33%) 36 (35%) #> 6 III 31 (32%) 33 (32%) #> 7 Tumor Response 28 (29%) 33 (34%) #> 8 Unknown 3 4 # without column labels as_tibble(tbl, col_labels = FALSE) #> # A tibble: 8 × 3 #> label stat_1 stat_2 #> #> 1 Age 46 (37, 60) 48 (39, 56) #> 2 Unknown 7 4 #> 3 Grade NA NA #> 4 I 35 (36%) 33 (32%) #> 5 II 32 (33%) 36 (35%) #> 6 III 31 (32%) 33 (32%) #> 7 Tumor Response 28 (29%) 33 (34%) #> 8 Unknown 3 4"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Default Digits — assign_summary_digits","title":"Assign Default Digits — assign_summary_digits","text":"Used assign default formatting variables summarized tbl_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Default Digits — assign_summary_digits","text":"","code":"assign_summary_digits(data, statistic, type, digits = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Default Digits — assign_summary_digits","text":"data (data.frame) data frame statistic (named list) named list; notably, formula-list-selector type (named list) named list; notably, formula-list-selector digits (named list) named list; notably, formula-list-selector. Default NULL","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Default Digits — assign_summary_digits","text":"named list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_digits.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Default Digits — assign_summary_digits","text":"","code":"assign_summary_digits( mtcars, statistic = list(mpg = \"{mean}\"), type = list(mpg = \"continuous\") ) #> $mpg #> $mpg$mean #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) #> #> #> #> $mpg$N_obs #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) #> #> #> #> $mpg$N_miss #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) #> #> #> #> $mpg$N_nonmiss #> function (x) #> style_number(x, digits = digits, big.mark = big.mark, decimal.mark = decimal.mark, #> scale = scale, prefix = prefix, suffix = suffix, ...) #> #> #> #> $mpg$p_miss #> function (x) #> style_percent(x, prefix = prefix, suffix = suffix, digits = digits, #> big.mark = big.mark, decimal.mark = decimal.mark, ...) #> #> #> #> $mpg$p_nonmiss #> function (x) #> style_percent(x, prefix = prefix, suffix = suffix, digits = digits, #> big.mark = big.mark, decimal.mark = decimal.mark, ...) #> #> #> #>"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Default Summary Type — assign_summary_type","title":"Assign Default Summary Type — assign_summary_type","text":"Function inspects data assigns summary type specified type argument.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Default Summary Type — assign_summary_type","text":"","code":"assign_summary_type(data, variables, value, type = NULL, cat_threshold = 10L)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Default Summary Type — assign_summary_type","text":"data (data.frame) data frame variables (character) character vector column names data value (named list) named list values show dichotomous variables, names variables type (named list) named list summary types, names variables cat_threshold (integer) base R numeric classes fewer levels threshold default categorical summary. Default 10L","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Default Summary Type — assign_summary_type","text":"named list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_summary_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Default Summary Type — assign_summary_type","text":"","code":"assign_summary_type( data = trial, variables = c(\"age\", \"grade\", \"response\"), value = NULL ) #> $age #> [1] \"continuous\" #> #> $grade #> [1] \"categorical\" #> #> $response #> [1] \"dichotomous\" #>"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":null,"dir":"Reference","previous_headings":"","what":"Assign Test — assign_tests","title":"Assign Test — assign_tests","text":"function used assign default tests add_p() add_difference().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Assign Test — assign_tests","text":"","code":"assign_tests(x, ...) # S3 method for class 'tbl_summary' assign_tests( x, include, by = x$inputs$by, test = NULL, group = NULL, adj.vars = NULL, summary_type = x$inputs$type, calling_fun = c(\"add_p\", \"add_difference\"), ... ) # S3 method for class 'tbl_svysummary' assign_tests( x, include, by = x$inputs$by, test = NULL, group = NULL, adj.vars = NULL, summary_type = x$inputs$type, calling_fun = c(\"add_p\", \"add_difference\"), ... ) # S3 method for class 'tbl_continuous' assign_tests(x, include, by, cont_variable, test = NULL, group = NULL, ...) # S3 method for class 'tbl_survfit' assign_tests(x, include, test = NULL, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Assign Test — assign_tests","text":"x (gtsummary) table class 'gtsummary' ... Passed rlang::abort(), rlang::warn() rlang::inform(). include (character) Character vector column names assign default tests. (string) single stratifying column name test (named list) named list tests. group (string) variable name indicating grouping column correlated data. Default NULL. adj.vars (character) Variables include adjusted calculations (e.g. ANCOVA models). summary_type (named list) named list summary types calling_fun (string) Must one 'add_p' 'add_difference'. Depending context, different defaults set. cont_variable (string) column name continuous summary variable tbl_continuous()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Assign Test — assign_tests","text":"table class 'gtsummary'","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/assign_tests.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Assign Test — assign_tests","text":"","code":"trial |> tbl_summary( by = trt, include = c(age, stage) ) |> assign_tests(include = c(\"age\", \"stage\"), calling_fun = \"add_p\") #> $age #> function (data, variable, by, test.args, conf.level = 0.95, ...) #> { #> check_pkg_installed(\"cardx\") #> check_empty(c(\"group\", \"adj.vars\"), ...) #> dplyr::mutate(rlang::inject(cardx::ard_stats_wilcox_test(data = data, #> variable = all_of(variable), by = all_of(by), conf.int = TRUE, #> conf.level = conf.level, !!!test.args)), stat = dplyr::case_when(.data$stat_name %in% #> \"method\" & .data$stat %in% \"Wilcoxon rank sum test with continuity correction\" ~ #> list(\"Wilcoxon rank sum test\"), .default = .data$stat)) #> } #> #> #> attr(,\"test_name\") #> [1] \"wilcox.test\" #> #> $stage #> function (data, variable, by, test.args, ...) #> { #> add_p_test_chisq.test(data = data, variable = variable, by = by, #> test.args = c(list(correct = FALSE), test.args), ...) #> } #> #> #> attr(,\"test_name\") #> [1] \"chisq.test.no.correct\" #>"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":null,"dir":"Reference","previous_headings":"","what":"Bold or Italicize — bold_italicize_labels_levels","title":"Bold or Italicize — bold_italicize_labels_levels","text":"Bold italicize labels levels gtsummary tables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bold or Italicize — bold_italicize_labels_levels","text":"","code":"bold_labels(x) italicize_labels(x) bold_levels(x) italicize_levels(x) # S3 method for class 'gtsummary' bold_labels(x) # S3 method for class 'gtsummary' bold_levels(x) # S3 method for class 'gtsummary' italicize_labels(x) # S3 method for class 'gtsummary' italicize_levels(x) # S3 method for class 'tbl_cross' bold_labels(x) # S3 method for class 'tbl_cross' bold_levels(x) # S3 method for class 'tbl_cross' italicize_labels(x) # S3 method for class 'tbl_cross' italicize_levels(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bold or Italicize — bold_italicize_labels_levels","text":"x (gtsummary) object class 'gtsummary'","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bold or Italicize — bold_italicize_labels_levels","text":"Functions return class gtsummary object supplied","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Bold or Italicize — bold_italicize_labels_levels","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_italicize_labels_levels.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bold or Italicize — bold_italicize_labels_levels","text":"","code":"# Example 1 ---------------------------------- tbl_summary(trial, include = c(\"trt\", \"age\", \"response\")) |> bold_labels() |> bold_levels() |> italicize_labels() |> italicize_levels() Characteristic N = 2001 Chemotherapy Treatment     Drug A 98 (49%)    Drug B 102 (51%)Age 47 (38, 57)    Unknown 11Tumor Response 61 (32%)    Unknown 71 n (%); Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":null,"dir":"Reference","previous_headings":"","what":"Bold significant p-values — bold_p","title":"Bold significant p-values — bold_p","text":"Bold values chosen threshold (e.g. <0.05) gtsummary tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bold significant p-values — bold_p","text":"","code":"bold_p(x, t = 0.05, q = FALSE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bold significant p-values — bold_p","text":"x (gtsummary) Object created using gtsummary functions t (scalar numeric) Threshold values bold. Default 0.05. q (scalar logical) TRUE bold q-value column rather p-value. Default FALSE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Bold significant p-values — bold_p","text":"Daniel D. Sjoberg, Esther Drill","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/bold_p.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bold significant p-values — bold_p","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(response, marker, trt), missing = \"no\") |> add_p() |> bold_p(t = 0.1) Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Tumor Response 28 (29%) 33 (34%) 0.5Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) 0.0851 n (%); Median (Q1, Q3) 2 Pearson’s Chi-squared test; Wilcoxon rank sum test # Example 2 ---------------------------------- glm(response ~ trt + grade, trial, family = binomial(link = \"logit\")) |> tbl_regression(exponentiate = TRUE) |> bold_p(t = 0.65) Characteristic OR 95% CI p-value Chemotherapy Treatment     Drug A — —     Drug B 1.21 0.66, 2.24 0.5Grade     I — —     II 0.94 0.44, 1.98 0.9    III 1.09 0.52, 2.27 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Continuous Summary Table Bridges — brdg_continuous","title":"Continuous Summary Table Bridges — brdg_continuous","text":"Bridge function converting tbl_continuous() cards basic gtsummary objects. bridge function converts 'cards' object format suitable pass brdg_summary(): pier_*() functions required.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Continuous Summary Table Bridges — brdg_continuous","text":"","code":"brdg_continuous(cards, by = NULL, statistic, include, variable, type)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Continuous Summary Table Bridges — brdg_continuous","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. (string) string indicating stratifying column statistic (named list) named list summary statistic names include (tidy-select) Variables include summary table. Default everything(). variable (tidy-select) single column data. Variable name continuous column summarized. type (named list) named list summary types","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Continuous Summary Table Bridges — brdg_continuous","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Continuous Summary Table Bridges — brdg_continuous","text":"","code":"library(cards) bind_ard( # the primary ARD with the results ard_continuous(trial, by = grade, variables = age), # add missing and attributes ARD ard_missing(trial, by = grade, variables = age), ard_attributes(trial, variables = c(grade, age)) ) |> # adding the column name dplyr::mutate( gts_column = ifelse(!context %in% \"attributes\", \"stat_0\", NA_character_) ) |> brdg_continuous( variable = \"age\", include = \"grade\", statistic = list(grade = \"{median} ({p25}, {p75})\"), type = list(grade = \"categorical\") ) |> as_tibble() #> # A tibble: 4 × 2 #> `**Characteristic**` stat_0 #> #> 1 Grade NA #> 2 I 47.0 (37.0, 56.0) #> 3 II 48.5 (37.0, 57.0) #> 4 III 47.0 (38.0, 58.0)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_hierarchical.html","id":null,"dir":"Reference","previous_headings":"","what":"Hierarchy table bridge — brdg_hierarchical","title":"Hierarchy table bridge — brdg_hierarchical","text":"Bridge function converting tbl_hierarchical() (similar) cards basic gtsummary objects. bridge functions begin prefix brdg_*(). file also contains helper functions constructing bridge, referred piers (supports bridge) begin pier_*(). brdg_hierarchical(): bridge function ingests ARD data frame returns gtsummary table includes .$table_body basic .$table_styling. .$table_styling$header data frame includes header statistics. Based context, function adds column ARD data frame named \"gts_column\". column used reshaping pier_*() functions defining column names. pier_*(): functions accept cards tibble returns tibble piece .$table_body. Typically stacked construct final table body data frame. ARD object passed two primary parts: calculated summary statistics attributes ARD. attributes ARD used labeling. ARD data frame passed function must include \"gts_column\" column, added brdg_hierarchical().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_hierarchical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Hierarchy table bridge — brdg_hierarchical","text":"","code":"brdg_hierarchical( cards, variables, by, include, statistic, overall_row, count, is_ordered, label ) pier_summary_hierarchical(cards, variables, include, statistic)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_hierarchical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Hierarchy table bridge — brdg_hierarchical","text":"cards (card) ARD object class \"card\" created cards::ard_hierarchical_stack(). variables (character) character list hierarchy variables. (string) string indicating stratifying column. include (character) character list hierarchy variables include summary statistics . statistic (named list) named list summary statistic names. overall_row (scalar logical) whether overall summary row included top table. default FALSE. count (scalar logical) whether tbl_hierarchical_count() (TRUE) tbl_hierarchical() (FALSE) applied. is_ordered (scalar logical) whether last variable variables ordered. label (named list) named list hierarchy variable labels.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_hierarchical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Hierarchy table bridge — brdg_hierarchical","text":"gtsummary object","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary table bridge — brdg_summary","title":"Summary table bridge — brdg_summary","text":"Bridge function converting tbl_summary() (similar) cards basic gtsummary objects. bridge functions begin prefix brdg_*(). file also contains helper functions constructing bridge, referred piers (supports bridge) begin pier_*(). brdg_summary(): bridge function ingests ARD data frame returns gtsummary table includes .$table_body basic .$table_styling. .$table_styling$header data frame includes header statistics. Based context, function adds column ARD data frame named \"gts_column\". column used reshaping pier_*() functions defining column names. pier_*(): functions accept cards tibble returns tibble piece .$table_body. Typically stacked construct final table body data frame. ARD object passed two primary parts: calculated summary statistics attributes ARD. attributes ARD used labeling. ARD data frame passed function must include \"gts_column\" column, added brdg_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary table bridge — brdg_summary","text":"","code":"brdg_summary( cards, variables, type, statistic, by = NULL, missing = \"no\", missing_stat = \"{N_miss}\", missing_text = \"Unknown\" ) pier_summary_dichotomous(cards, variables, statistic) pier_summary_categorical(cards, variables, statistic) pier_summary_continuous2(cards, variables, statistic) pier_summary_continuous(cards, variables, statistic) pier_summary_missing_row( cards, variables, missing = \"no\", missing_stat = \"{N_miss}\", missing_text = \"Unknown\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary table bridge — brdg_summary","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. variables (character) character list variables type (named list) named list summary types statistic (named list) named list summary statistic names (string) string indicating stratifying column missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"ifany\", \"\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary table bridge — brdg_summary","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary table bridge — brdg_summary","text":"","code":"library(cards) # first build ARD data frame cards <- ard_stack( mtcars, ard_continuous(variables = c(\"mpg\", \"hp\")), ard_categorical(variables = \"cyl\"), ard_dichotomous(variables = \"am\"), .missing = TRUE, .attributes = TRUE ) |> # this column is used by the `pier_*()` functions dplyr::mutate(gts_column = ifelse(context == \"attributes\", NA, \"stat_0\")) brdg_summary( cards = cards, variables = c(\"cyl\", \"am\", \"mpg\", \"hp\"), type = list( cyl = \"categorical\", am = \"dichotomous\", mpg = \"continuous\", hp = \"continuous2\" ), statistic = list( cyl = \"{n} / {N}\", am = \"{n} / {N}\", mpg = \"{mean} ({sd})\", hp = c(\"{median} ({p25}, {p75})\", \"{mean} ({sd})\") ) ) |> as_tibble() #> # A tibble: 9 × 2 #> `**Characteristic**` stat_0 #> #> 1 cyl NA #> 2 4 11 / 32 #> 3 6 7 / 32 #> 4 8 14 / 32 #> 5 am 13 / 32 #> 6 mpg 20.1 (6.0) #> 7 hp NA #> 8 Median (Q1, Q3) 123.0 (96.0, 180.0) #> 9 Mean (SD) 146.7 (68.6) pier_summary_dichotomous( cards = cards, variables = \"am\", statistic = list(am = \"{n} ({p})\") ) #> # A tibble: 1 × 5 #> row_type var_label variable label stat_0 #> #> 1 label am am am 13 (40.6) pier_summary_categorical( cards = cards, variables = \"cyl\", statistic = list(cyl = \"{n} ({p})\") ) #> # A tibble: 4 × 5 #> variable var_label row_type label stat_0 #> #> 1 cyl cyl label cyl NA #> 2 cyl cyl level 4 11 (34.4) #> 3 cyl cyl level 6 7 (21.9) #> 4 cyl cyl level 8 14 (43.8) pier_summary_continuous2( cards = cards, variables = \"hp\", statistic = list(hp = c(\"{median}\", \"{mean}\")) ) #> # A tibble: 3 × 5 #> variable var_label row_type label stat_0 #> #> 1 hp hp label hp NA #> 2 hp hp level Median 123.0 #> 3 hp hp level Mean 146.7 pier_summary_continuous( cards = cards, variables = \"mpg\", statistic = list(mpg = \"{median}\") ) #> # A tibble: 1 × 5 #> row_type var_label variable label stat_0 #> #> 1 label mpg mpg mpg 19.2"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide summary table bridge — brdg_wide_summary","title":"Wide summary table bridge — brdg_wide_summary","text":"Bridge function converting tbl_wide_summary() (similar) cards basic gtsummary objects. bridge functions begin prefix brdg_*().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide summary table bridge — brdg_wide_summary","text":"","code":"brdg_wide_summary(cards, variables, statistic, type)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wide summary table bridge — brdg_wide_summary","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. variables (character) character list variables statistic (named list) named list summary statistic names type (named list) named list summary types","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wide summary table bridge — brdg_wide_summary","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/brdg_wide_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Wide summary table bridge — brdg_wide_summary","text":"","code":"library(cards) bind_ard( ard_continuous(trial, variables = c(age, marker)), ard_attributes(trial, variables = c(age, marker)) ) |> brdg_wide_summary( variables = c(\"age\", \"marker\"), statistic = list(age = c(\"{mean}\", \"{sd}\"), marker = c(\"{mean}\", \"{sd}\")), type = list(age = \"continuous\", marker = \"continuous\") ) Characteristic Mean SD Age 47.2 14.3Marker Level (ng/mL) 0.9 0.9"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":null,"dir":"Reference","previous_headings":"","what":"Combine terms — combine_terms","title":"Combine terms — combine_terms","text":"function combines terms regression model, replaces terms single row output table. p-value calculated using stats::anova().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Combine terms — combine_terms","text":"","code":"combine_terms(x, formula_update, label = NULL, quiet, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Combine terms — combine_terms","text":"x (tbl_regression) tbl_regression object formula_update (formula) formula update passed stats::update(). updated formula used construct reduced model, subsequently passed stats::anova() calculate p-value group removed terms. See stats::update() function's formula.= argument proper syntax. label (string) Optional string argument labeling combined rows quiet ... Additional arguments passed stats::anova","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Combine terms — combine_terms","text":"tbl_regression object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Combine terms — combine_terms","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/combine_terms.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Combine terms — combine_terms","text":"","code":"# Example 1 ---------------------------------- # Logistic Regression Example, LRT p-value glm(response ~ marker + I(marker^2) + grade, trial[c(\"response\", \"marker\", \"grade\")] |> na.omit(), # keep complete cases only! family = binomial) |> tbl_regression(label = grade ~ \"Grade\", exponentiate = TRUE) |> # collapse non-linear terms to a single row in output using anova combine_terms( formula_update = . ~ . - marker - I(marker^2), label = \"Marker (non-linear terms)\", test = \"LRT\" ) Characteristic OR 95% CI p-value Marker (non-linear terms) 0.2Grade     I — —     II 1.16 0.52, 2.55 0.7    III 1.07 0.50, 2.30 0.9Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize a continuous variable — continuous_summary","title":"Summarize a continuous variable — continuous_summary","text":"helper, used tbl_custom_summary(), creates function summarizing continuous variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize a continuous variable — continuous_summary","text":"","code":"continuous_summary(variable)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize a continuous variable — continuous_summary","text":"variable (string) String indicating name variable summarized. variable continuous.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Summarize a continuous variable — continuous_summary","text":"using continuous_summary(), can specify statistic= argument tbl_custom_summary() continuous statistics tbl_summary(). See statistic argument section help file tbl_summary().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/continuous_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summarize a continuous variable — continuous_summary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":null,"dir":"Reference","previous_headings":"","what":"Custom tidiers — custom_tidiers","title":"Custom tidiers — custom_tidiers","text":"Collection tidiers can utilized gtsummary. See details .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Custom tidiers — custom_tidiers","text":"","code":"tidy_standardize( x, exponentiate = FALSE, conf.level = 0.95, conf.int = TRUE, ..., quiet = FALSE ) tidy_bootstrap( x, exponentiate = FALSE, conf.level = 0.95, conf.int = TRUE, ..., quiet = FALSE ) tidy_robust( x, exponentiate = FALSE, conf.level = 0.95, conf.int = TRUE, vcov = NULL, vcov_args = NULL, ..., quiet = FALSE ) pool_and_tidy_mice(x, pool.args = NULL, ..., quiet = FALSE) tidy_gam(x, conf.int = FALSE, exponentiate = FALSE, conf.level = 0.95, ...) tidy_wald_test(x, tidy_fun = NULL, vcov = stats::vcov(x), ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Custom tidiers — custom_tidiers","text":"x (model) Regression model object exponentiate (scalar logical) Logical indicating whether exponentiate coefficient estimates. Default FALSE. conf.level (scalar real) Confidence level confidence interval/credible interval. Defaults 0.95. conf.int (scalar logical) Logical indicating whether include confidence interval output. Default TRUE. ... Arguments passed method; pool_and_tidy_mice(): mice::tidy(x, ...) tidy_standardize(): parameters::standardize_parameters(x, ...) tidy_bootstrap(): parameters::bootstrap_parameters(x, ...) tidy_robust(): parameters::model_parameters(x, ...) quiet vcov, vcov_args tidy_robust(): Arguments passed parameters::model_parameters(). least one arguments must specified. tidy_wald_test(): vcov covariance matrix model default stats::vcov(). pool.args (named list) Named list arguments passed mice::pool() pool_and_tidy_mice(). Default NULL tidy_fun (function) Tidier function model. Default use broom::tidy(). error occurs, tidying model attempted parameters::model_parameters(), installed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"regression-model-tidiers","dir":"Reference","previous_headings":"","what":"Regression Model Tidiers","title":"Custom tidiers — custom_tidiers","text":"tidiers passed tbl_regression() tbl_uvregression() obtain modified results. tidy_standardize() tidier report standardized coefficients. parameters package includes wonderful function estimate standardized coefficients. tidier uses output parameters::standardize_parameters(), merely takes result puts broom::tidy() format. tidy_bootstrap() tidier report bootstrapped coefficients. parameters package includes wonderful function estimate bootstrapped coefficients. tidier uses output parameters::bootstrap_parameters(test = \"p\"), merely takes result puts broom::tidy() format. tidy_robust() tidier report robust standard errors, confidence intervals, p-values. parameters package includes wonderful function calculate robust standard errors, confidence intervals, p-values tidier uses output parameters::model_parameters(), merely takes result puts broom::tidy() format. use function tbl_regression(), pass function arguments tidy_robust() populated. pool_and_tidy_mice() tidier report models resulting multiply imputed data using mice package. Pass mice model object model results pooled. See example.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"other-tidiers","dir":"Reference","previous_headings":"","what":"Other Tidiers","title":"Custom tidiers — custom_tidiers","text":"tidy_wald_test() tidier report Wald p-values, wrapping aod::wald.test() function. Use tidier add_global_p(anova_fun = tidy_wald_test)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/custom_tidiers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Custom tidiers — custom_tidiers","text":"","code":"# Example 1 ---------------------------------- mod <- lm(age ~ marker + grade, trial) tbl_stnd <- tbl_regression(mod, tidy_fun = tidy_standardize) tbl <- tbl_regression(mod) tidy_standardize_ex1 <- tbl_merge( list(tbl_stnd, tbl), tab_spanner = c(\"**Standardized Model**\", \"**Original Model**\") ) # Example 2 ---------------------------------- # use \"posthoc\" method for coef calculation tbl_regression(mod, tidy_fun = \\(x, ...) tidy_standardize(x, method = \"posthoc\", ...)) Characteristic Beta 95% CI Marker Level (ng/mL) 0.00 -0.15, 0.15Grade     I — —    II 0.04 -0.32, 0.41    III 0.17 -0.20, 0.53Abbreviation: CI = Confidence Interval # Example 3 ---------------------------------- # Multiple Imputation using the mice package set.seed(1123) pool_and_tidy_mice_ex3 <- suppressWarnings(mice::mice(trial, m = 2)) |> with(lm(age ~ marker + grade)) |> tbl_regression() #> #> iter imp variable #> 1 1 age marker response #> 1 2 age marker response #> 2 1 age marker response #> 2 2 age marker response #> 3 1 age marker response #> 3 2 age marker response #> 4 1 age marker response #> 4 2 age marker response #> 5 1 age marker response #> 5 2 age marker response"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/default_stat_labels.html","id":null,"dir":"Reference","previous_headings":"","what":"Default Statistics Labels — default_stat_labels","title":"Default Statistics Labels — default_stat_labels","text":"Default Statistics Labels","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/default_stat_labels.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Default Statistics Labels — default_stat_labels","text":"","code":"default_stat_labels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/default_stat_labels.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Default Statistics Labels — default_stat_labels","text":"named list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated.html","id":null,"dir":"Reference","previous_headings":"","what":"Deprecated functions — deprecated","title":"Deprecated functions — deprecated","text":"functions deprecated longer actively supported.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Deprecated functions — deprecated","text":"","code":"modify_cols_merge(...)"},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_ci_column.html","id":"overview","dir":"Reference","previous_headings":"","what":"Overview","title":"Column ","text":"gtsummary package first written, gt package CRAN version package available ability merge columns. Due limitations, pre-formatted \"ci\" column added show combined \"conf.low\" \"conf.high\" columns. Column merging gt gtsummary packages matured years, now adopting modern approach using features. result, pre-formatted \"ci\" column eventually dropped .$table_body. using column merging, conf.low conf.high remain numeric can continue update columns formatted, even printing table. \"ci\" column hidden, meaning appears .$table_body, printed. means references column code error, likely intended effect.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_ci_column.html","id":"how-to-update-","dir":"Reference","previous_headings":"","what":"How to update?","title":"Column ","text":"cases simple change adapt code updated structure: simply swap ci conf.low. See examples update code.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_ci_column.html","id":"modify-header-","dir":"Reference","previous_headings":"","what":"modify_header()","title":"Column ","text":"\"ci\" column hidden, new header defined column unhidden. Code changes header \"ci\" likely lead duplicate columns appearing table (, \"ci\" column merged \"conf.low\" \"conf.high\" columns).","code":""},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":null,"dir":"Reference","previous_headings":"","what":"DEPRECATED Footnote — deprecated_modify_footnote","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"Use modify_footnote_header() modify_abbreviation() instead.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"","code":"modify_footnote( x, ..., abbreviation = FALSE, text_interpret = c(\"md\", \"html\"), update, quiet )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"x (gtsummary) gtsummary object ... dynamic-dots Used assign updates footnotes. Use modify_footnote(colname='new footnote') update single footnote. abbreviation (scalar logical) Logical indicating abbreviation updated. text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}. update, quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/deprecated_modify_footnote.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"DEPRECATED Footnote — deprecated_modify_footnote","text":"","code":"# Use `modify_footnote_header()`, `modify_footnote_body()`, `modify_abbreviation()` instead."},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-create_gtsummary_object.html","id":null,"dir":"Reference","previous_headings":"","what":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","title":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","text":"Function uses table_body create gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-create_gtsummary_object.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","text":"","code":".create_gtsummary_object(table_body, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-create_gtsummary_object.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","text":"table_body table_body tibble ... objects added gtsummary object list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-create_gtsummary_object.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Function uses table_body to create a gtsummary object — .create_gtsummary_object","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert Named List to Table Body — .list2tb","title":"Convert Named List to Table Body — .list2tb","text":"Many arguments 'gtsummary' accept named lists. function converts named list .$table_body format expected scope_table_body()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert Named List to Table Body — .list2tb","text":"","code":".list2tb(x, colname = caller_arg(x))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert Named List to Table Body — .list2tb","text":"x named list colname string column name assign. Default caller_arg(x)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert Named List to Table Body — .list2tb","text":".$table_body data frame","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-list2tb.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Convert Named List to Table Body — .list2tb","text":"","code":"type <- list(age = \"continuous\", response = \"dichotomous\") gtsummary:::.list2tb(type, \"var_type\") #> # A tibble: 2 × 2 #> variable var_type #> #> 1 age continuous #> 2 response dichotomous"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":null,"dir":"Reference","previous_headings":"","what":"Object Convert Helper — .table_styling_expr_to_row_number","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"Ahead gtsummary object converted output type, logical expression saved x$table_styling converted list row numbers.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"","code":".table_styling_expr_to_row_number(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"x gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/dot-table_styling_expr_to_row_number.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Object Convert Helper — .table_styling_expr_to_row_number","text":"","code":"tbl <- trial %>% tbl_summary(include = c(age, grade)) %>% .table_styling_expr_to_row_number()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":null,"dir":"Reference","previous_headings":"","what":"Extract ARDs — gather_ard","title":"Extract ARDs — gather_ard","text":"Extract ARDs gtsummary table. needed, results may combined cards::bind_ard().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Extract ARDs — gather_ard","text":"","code":"gather_ard(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Extract ARDs — gather_ard","text":"x (gtsummary) gtsummary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Extract ARDs — gather_ard","text":"list","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gather_ard.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Extract ARDs — gather_ard","text":"","code":"tbl_summary(trial, by = trt, include = age) |> add_overall() |> add_p() |> gather_ard() #> $tbl_summary #> {cards} data frame: 27 x 12 #> group1 group1_level variable variable_level stat_name stat_label stat #> 1 trt Drug A age median Median 46 #> 2 trt Drug A age p25 Q1 37 #> 3 trt Drug A age p75 Q3 60 #> 4 trt Drug B age median Median 48 #> 5 trt Drug B age p25 Q1 39 #> 6 trt Drug B age p75 Q3 56 #> 7 age label Variable… Age #> 8 age class Variable… numeric #> 9 trt label Variable… Chemothe… #> 10 trt class Variable… character #> ℹ 17 more rows #> ℹ Use `print(n = ...)` to see more rows #> ℹ 5 more variables: context, fmt_fn, warning, error, gts_column #> #> $add_overall #> {cards} data frame: 11 x 9 #> variable context stat_name stat_label stat fmt_fn #> 1 age continuo… median Median 47 #> 2 age continuo… p25 Q1 38 #> 3 age continuo… p75 Q3 57 #> 4 age attribut… label Variable… Age #> 5 age attribut… class Variable… numeric NULL #> 6 age missing N_obs No. obs. 200 #> 7 age missing N_miss N Missing 11 #> 8 age missing N_nonmiss N Non-mi… 189 #> 9 age missing p_miss % Missing 0.055 #> 10 age missing p_nonmiss % Non-mi… 0.945 #> 11 ..ard_total_n.. total_n N N 200 0 #> ℹ 3 more variables: warning, error, gts_column #> #> $add_p #> $add_p$age #> {cards} data frame: 15 x 9 #> group1 variable context stat_name stat_label stat #> 1 trt age stats_wi… estimate Median o… -1 #> 2 trt age stats_wi… statistic X-square… 4323 #> 3 trt age stats_wi… p.value p-value 0.718 #> 4 trt age stats_wi… conf.low CI Lower… -5 #> 5 trt age stats_wi… conf.high CI Upper… 4 #> 6 trt age stats_wi… method method Wilcoxon… #> 7 trt age stats_wi… alternative alternat… two.sided #> 8 trt age stats_wi… mu mu 0 #> 9 trt age stats_wi… paired Paired t… FALSE #> 10 trt age stats_wi… exact exact #> 11 trt age stats_wi… correct correct TRUE #> 12 trt age stats_wi… conf.int conf.int TRUE #> 13 trt age stats_wi… conf.level CI Confi… 0.95 #> 14 trt age stats_wi… tol.root tol.root 0 #> 15 trt age stats_wi… digits.rank digits.r… Inf #> ℹ 3 more variables: fmt_fn, warning, error #> #> glm(response ~ trt, data = trial, family = binomial()) |> tbl_regression() |> gather_ard() #> {cards} data frame: 29 x 9 #> variable variable_level context stat_name stat_label stat #> 1 trt Drug A regressi… term term trtDrug A #> 2 trt Drug A regressi… var_label Label Chemothe… #> 3 trt Drug A regressi… var_class Class character #> 4 trt Drug A regressi… var_type Type dichotom… #> 5 trt Drug A regressi… var_nlevels N Levels 2 #> 6 trt Drug A regressi… contrasts contrasts contr.tr… #> 7 trt Drug A regressi… contrasts_type Contrast… treatment #> 8 trt Drug A regressi… reference_row referenc… TRUE #> 9 trt Drug A regressi… label Level La… Drug A #> 10 trt Drug A regressi… n_obs N Obs. 95 #> ℹ 19 more rows #> ℹ Use `print(n = ...)` to see more rows #> ℹ 3 more variables: fmt_fn, warning, error"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":null,"dir":"Reference","previous_headings":"","what":"Default glance function — glance_fun_s3","title":"Default glance function — glance_fun_s3","text":"S3 generic used default function add_glance*(glance_fun). provided various regression model classes can default functions returning statistics.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Default glance function — glance_fun_s3","text":"","code":"glance_fun_s3(x, ...) # Default S3 method glance_fun_s3(x, ...) # S3 method for class 'mira' glance_fun_s3(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Default glance function — glance_fun_s3","text":"x (regression model) regression model object ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Default glance function — glance_fun_s3","text":"function","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/glance_fun_s3.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Default glance function — glance_fun_s3","text":"","code":"mod <- lm(age ~ trt, trial) glance_fun_s3(mod) #> function (x, ...) #> { #> UseMethod(\"glance\") #> } #> #> "},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/global_pvalue_fun.html","id":null,"dir":"Reference","previous_headings":"","what":"Global p-value generic — global_pvalue_fun","title":"Global p-value generic — global_pvalue_fun","text":"S3 generic serves default add_global_p(anova_fun). default function uses car::Anova() (via cardx::ard_car_anova()) calculate p-values. method GEE models (created geepack::geeglm()) returns Wald tests calculated using aod::wald.test() (via cardx::ard_aod_wald_test()). method, type argument used.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/global_pvalue_fun.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Global p-value generic — global_pvalue_fun","text":"","code":"global_pvalue_fun(x, type, ...) # Default S3 method global_pvalue_fun(x, type, ...) # S3 method for class 'geeglm' global_pvalue_fun(x, type, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/global_pvalue_fun.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Global p-value generic — global_pvalue_fun","text":"data frame","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/global_pvalue_fun.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Global p-value generic — global_pvalue_fun","text":"","code":"lm(age ~ stage + grade, trial) |> global_pvalue_fun(type = \"III\") #> {cards} data frame: 15 x 8 #> variable context stat_name stat_label stat fmt_fn #> 1 (Intercept) car_anova sumsq sumsq 65248.66 1 #> 2 (Intercept) car_anova df Degrees … 1 1 #> 3 (Intercept) car_anova meansq meansq 65248.66 1 #> 4 (Intercept) car_anova statistic Statistic 315.641 1 #> 5 (Intercept) car_anova p.value p-value 0 1 #> 6 stage car_anova sumsq sumsq 548.715 1 #> 7 stage car_anova df Degrees … 3 1 #> 8 stage car_anova meansq meansq 182.905 1 #> 9 stage car_anova statistic Statistic 0.885 1 #> 10 stage car_anova p.value p-value 0.45 1 #> 11 grade car_anova sumsq sumsq 166.309 1 #> 12 grade car_anova df Degrees … 2 1 #> 13 grade car_anova meansq meansq 83.154 1 #> 14 grade car_anova statistic Statistic 0.402 1 #> 15 grade car_anova p.value p-value 0.669 1 #> ℹ 2 more variables: warning, error"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gtsummary-package.html","id":null,"dir":"Reference","previous_headings":"","what":"gtsummary: Presentation-Ready Data Summary and Analytic Result Tables — gtsummary-package","title":"gtsummary: Presentation-Ready Data Summary and Analytic Result Tables — gtsummary-package","text":"Creates presentation-ready tables summarizing data sets, regression models, . code create tables concise highly customizable. Data frames can summarized function, e.g. mean(), median(), even user-written functions. Regression models summarized include reference rows categorical variables. Common regression models, logistic regression Cox proportional hazards regression, automatically identified tables pre-filled appropriate column headers.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/gtsummary-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"gtsummary: Presentation-Ready Data Summary and Analytic Result Tables — gtsummary-package","text":"Maintainer: Daniel D. Sjoberg danield.sjoberg@gmail.com (ORCID) Authors: Joseph Larmarange (ORCID) Michael Curry (ORCID) Jessica Lavery (ORCID) Karissa Whiting (ORCID) Emily C. Zabor (ORCID) contributors: Xing Bai [contributor] Esther Drill (ORCID) [contributor] Jessica Flynn (ORCID) [contributor] Margie Hannum (ORCID) [contributor] Stephanie Lobaugh [contributor] Shannon Pileggi (ORCID) [contributor] Amy Tin (ORCID) [contributor] Gustavo Zapata Wainberg (ORCID) [contributor]","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from summary tables inline — inline_text.gtsummary","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"Report statistics summary tables inline","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"","code":"# S3 method for class 'gtsummary' inline_text(x, variable, level = NULL, column = NULL, pattern = NULL, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"x (gtsummary) gtsummary object variable (tidy-select) single variable name statistic present level (string) Level variable display categorical variables. Default NULL column (tidy-select) Column name return x$table_body. pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default NULL ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"string","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.gtsummary.html","id":"column-pattern","dir":"Reference","previous_headings":"","what":"column + pattern","title":"Report statistics from summary tables inline — inline_text.gtsummary","text":"gtsummary tables report multiple statistics single cell, e.g. \"{mean} ({sd})\" tbl_summary() tbl_svysummary(). often need report just mean SD, can accomplished using column= pattern= arguments. arguments specified, column argument selects column report statistics , pattern argument specifies statistics report, e.g. inline_text(x, column = \"stat_1\", pattern = \"{mean}\") reports just mean tbl_summary(). supported tables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from gtsummary tables inline — inline_text","title":"Report statistics from gtsummary tables inline — inline_text","text":"Report statistics gtsummary tables inline","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from gtsummary tables inline — inline_text","text":"","code":"inline_text(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from gtsummary tables inline — inline_text","text":"x (gtsummary) Object created gtsummary function ... Additional arguments passed methods.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from gtsummary tables inline — inline_text","text":"string reporting results gtsummary table","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from gtsummary tables inline — inline_text","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from summary tables inline — inline_text.tbl_continuous","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"Extracts returns statistics tbl_continuous() object inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"","code":"# S3 method for class 'tbl_continuous' inline_text( x, variable, column = NULL, level = NULL, pattern = NULL, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"x (tbl_continuous) Object created tbl_continuous() variable (tidy-select) single variable name statistic present column (tidy-select) Column name return x$table_body. Can also pass level variable. level (string) Level variable display categorical variables. Default NULL pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default NULL pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from summary tables inline — inline_text.tbl_continuous","text":"","code":"t1 <- trial |> tbl_summary(by = trt, include = grade) |> add_p() inline_text(t1, variable = grade, level = \"I\", column = \"Drug A\", pattern = \"{n}/{N} ({p}%)\") #> 35/98 (36%) inline_text(t1, variable = grade, column = \"p.value\") #> [1] \"p=0.9\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from cross table inline — inline_text.tbl_cross","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"Extracts returns statistics tbl_cross object inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"","code":"# S3 method for class 'tbl_cross' inline_text( x, col_level, row_level = NULL, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"x (tbl_cross) tbl_cross object col_level (string) Level column variable display. Can also specify \"p.value\" p-value \"stat_0\" Total column. row_level (string) Level row variable display. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from cross table inline — inline_text.tbl_cross","text":"","code":"tbl_cross <- tbl_cross(trial, row = trt, col = response) %>% add_p() inline_text(tbl_cross, row_level = \"Drug A\", col_level = \"1\") #> [1] \"28\" inline_text(tbl_cross, row_level = \"Total\", col_level = \"1\") #> [1] \"61\" inline_text(tbl_cross, col_level = \"p.value\") #> [1] \"p=0.7\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from regression summary tables inline — inline_text.tbl_regression","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"Takes object class tbl_regression, location statistic report returns statistics reporting inline R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"","code":"# S3 method for class 'tbl_regression' inline_text( x, variable, level = NULL, pattern = \"{estimate} ({conf.level*100}% CI {conf.low}, {conf.high}; {p.value})\", estimate_fun = x$inputs$estimate_fun, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"x (tbl_regression) Object created tbl_regression() variable (tidy-select) single variable name statistic present level (string) Level variable display categorical variables. Default NULL pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default \"{estimate} ({conf.level }\\% CI {conf.low}, {conf.high}; {p.value})\". columns x$table_body available print well confidence level (conf.level). See details. estimate_fun (function) Function style model coefficient estimates. Columns 'estimate', 'conf.low', 'conf.high' formatted. Default x$inputs$estimate_fun pvalue_fun function style p-values /q-values. Default label_style_pvalue(prepend_p = TRUE) ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"pattern-argument","dir":"Reference","previous_headings":"","what":"pattern argument","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"following items () available print. Use print(x$table_body) print table estimates extracted . {estimate} coefficient estimate formatted 'estimate_fun' {conf.low} lower limit confidence interval formatted 'estimate_fun' {conf.high} upper limit confidence interval formatted 'estimate_fun' {p.value} p-value formatted 'pvalue_fun' {N} number observations model {label} variable/variable level label","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_regression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from regression summary tables inline — inline_text.tbl_regression","text":"","code":"inline_text_ex1 <- glm(response ~ age + grade, trial, family = binomial(link = \"logit\")) %>% tbl_regression(exponentiate = TRUE) inline_text(inline_text_ex1, variable = age) #> [1] \"1.02 (95% CI 1.00, 1.04; p=0.10)\" inline_text(inline_text_ex1, variable = grade, level = \"III\") #> [1] \"1.01 (95% CI 0.47, 2.16; p>0.9)\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from summary tables inline — inline_text.tbl_summary","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"Extracts returns statistics tbl_summary() object inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"","code":"# S3 method for class 'tbl_summary' inline_text( x, variable, column = NULL, level = NULL, pattern = NULL, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... ) # S3 method for class 'tbl_svysummary' inline_text( x, variable, column = NULL, level = NULL, pattern = NULL, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"x (tbl_summary) Object created tbl_summary() tbl_svysummary() variable (tidy-select) single variable name statistic present column (tidy-select) Column name return x$table_body. Can also pass level variable. level (string) Level variable display categorical variables. Default NULL pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default NULL pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from summary tables inline — inline_text.tbl_summary","text":"","code":"t1 <- trial |> tbl_summary(by = trt, include = grade) |> add_p() inline_text(t1, variable = grade, level = \"I\", column = \"Drug A\", pattern = \"{n}/{N} ({p}%)\") #> 35/98 (36%) inline_text(t1, variable = grade, column = \"p.value\") #> [1] \"p=0.9\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from survfit tables inline — inline_text.tbl_survfit","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"Extracts returns statistics tbl_survfit object inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"","code":"# S3 method for class 'tbl_survfit' inline_text( x, variable = NULL, level = NULL, pattern = NULL, time = NULL, prob = NULL, column = NULL, estimate_fun = x$inputs$estimate_fun, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"x (tbl_survfit) Object created tbl_survfit() variable (tidy-select) Variable name statistic present. level (string) Level variable display categorical variables. Can also specify 'Unknown' row. Default NULL pattern (string) String indicating statistics return. time, prob (numeric scalar) time probability return result column (tidy-select) column print x$table_body. Columns may selected time prob arguments well. estimate_fun (function) Function round format estimate confidence limits. Default function used tbl_survfit() pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). function must numeric vector input, return string rounded/formatted p-value (e.g. pvalue_fun = label_style_pvalue(digits = 2)). ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from survfit tables inline — inline_text.tbl_survfit","text":"","code":"library(survival) # fit survfit fit1 <- survfit(Surv(ttdeath, death) ~ trt, trial) fit2 <- survfit(Surv(ttdeath, death) ~ 1, trial) # sumarize survfit objects tbl1 <- tbl_survfit( fit1, times = c(12, 24), label = ~\"Treatment\", label_header = \"**{time} Month**\" ) %>% add_p() tbl2 <- tbl_survfit( fit2, probs = 0.5, label_header = \"**Median Survival**\" ) # report results inline inline_text(tbl1, time = 24, level = \"Drug B\") #> [1] \"41% (33%, 52%)\" inline_text(tbl1, time = 24, level = \"Drug B\", pattern = \"{estimate} [95% CI {conf.low}, {conf.high}]\") #> 41% [95% CI 33%, 52%] inline_text(tbl1, column = p.value) #> [1] \"p=0.2\" inline_text(tbl2, prob = 0.5) #> [1] \"22 (21, —)\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":null,"dir":"Reference","previous_headings":"","what":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"Extracts returns statistics table created tbl_uvregression function inline reporting R markdown document. Detailed examples inline_text vignette","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"","code":"# S3 method for class 'tbl_uvregression' inline_text( x, variable, level = NULL, pattern = \"{estimate} ({conf.level*100}% CI {conf.low}, {conf.high}; {p.value})\", estimate_fun = x$inputs$estimate_fun, pvalue_fun = label_style_pvalue(prepend_p = TRUE), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"x (tbl_uvregression) Object created tbl_uvregression() variable (tidy-select) single variable name statistic present level (string) Level variable display categorical variables. Default NULL pattern (string) String indicating statistics return. Uses glue::glue() formatting. Default NULL estimate_fun (function) Function style model coefficient estimates. Columns 'estimate', 'conf.low', 'conf.high' formatted. Default x$inputs$estimate_fun pvalue_fun function style p-values /q-values. Default label_style_pvalue(prepend_p = TRUE) ... dots future extensions must empty.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"string reporting results gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"pattern-argument","dir":"Reference","previous_headings":"","what":"pattern argument","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"following items () available print. Use print(x$table_body) print table estimates extracted . {estimate} coefficient estimate formatted 'estimate_fun' {conf.low} lower limit confidence interval formatted 'estimate_fun' {conf.high} upper limit confidence interval formatted 'estimate_fun' {p.value} p-value formatted 'pvalue_fun' {N} number observations model {label} variable/variable level label","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/inline_text.tbl_uvregression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Report statistics from regression summary tables inline — inline_text.tbl_uvregression","text":"","code":"inline_text_ex1 <- trial[c(\"response\", \"age\", \"grade\")] %>% tbl_uvregression( method = glm, method.args = list(family = binomial), y = response, exponentiate = TRUE ) inline_text(inline_text_ex1, variable = age) #> [1] \"1.02 (95% CI 1.00, 1.04; p=0.10)\" inline_text(inline_text_ex1, variable = grade, level = \"III\") #> [1] \"1.10 (95% CI 0.52, 2.29; p=0.8)\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":null,"dir":"Reference","previous_headings":"","what":"Is a date/time — is_date_time","title":"Is a date/time — is_date_time","text":"is_date_time(): Predicate date, time, date-time vector identification.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Is a date/time — is_date_time","text":"","code":"is_date_time(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Is a date/time — is_date_time","text":"x vector","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Is a date/time — is_date_time","text":"scalar logical","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/is_date_time.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Is a date/time — is_date_time","text":"","code":"iris |> dplyr::mutate(date = as.Date(\"2000-01-01\") + dplyr::row_number()) |> lapply(gtsummary:::is_date_time) #> $Sepal.Length #> [1] FALSE #> #> $Sepal.Width #> [1] FALSE #> #> $Petal.Length #> [1] FALSE #> #> $Petal.Width #> [1] FALSE #> #> $Species #> [1] FALSE #> #> $date #> [1] TRUE #>"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":null,"dir":"Reference","previous_headings":"","what":"Special Character Escape — kableExtra_utils","title":"Special Character Escape — kableExtra_utils","text":"utility functions copied internals kableExtra, assist escaping special characters LaTeX HTML tables. function assist creations tables via as_kable_extra().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Special Character Escape — kableExtra_utils","text":"","code":".escape_html(x) .escape_latex(x, newlines = TRUE, align = \"c\") .escape_latex2(x, newlines = TRUE, align = \"c\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Special Character Escape — kableExtra_utils","text":"x character vector","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Special Character Escape — kableExtra_utils","text":"character vector escaped special characters","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/kableExtra_utils.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Special Character Escape — kableExtra_utils","text":"","code":".escape_latex(c(\"%\", \"{test}\")) #> [1] \"\\\\%\" \"\\\\{test\\\\}\" .escape_html(c(\">0.9\", \"line\\nbreak\")) #> [1] \">0.9\" \"line
break\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":null,"dir":"Reference","previous_headings":"","what":"Style Functions — label_style","title":"Style Functions — label_style","text":"Similar style_*() family functions, functions return style_*() function rather performing styling.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style Functions — label_style","text":"","code":"label_style_number( digits = 0, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), scale = 1, prefix = \"\", suffix = \"\", ... ) label_style_sigfig( digits = 2, scale = 1, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", ... ) label_style_pvalue( digits = 1, prepend_p = FALSE, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), ... ) label_style_ratio( digits = 2, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", ... ) label_style_percent( prefix = \"\", suffix = \"\", digits = 0, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style Functions — label_style","text":"digits, big.mark, decimal.mark, scale, prepend_p, prefix, suffix, ... arguments passed style_*() functions","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style Functions — label_style","text":"function","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/label_style.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style Functions — label_style","text":"","code":"my_style <- label_style_number(digits = 1) my_style(3.14) #> [1] \"3.1\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify column headers, footnotes, and spanning headers — modify","title":"Modify column headers, footnotes, and spanning headers — modify","text":"functions assist modifying aesthetics/style table. modify_header() update column headers modify_spanning_header() update/add spanning headers functions often require users know underlying column names. Run show_header_names() print column names console.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify column headers, footnotes, and spanning headers — modify","text":"","code":"modify_header(x, ..., text_interpret = c(\"md\", \"html\"), quiet, update) modify_spanning_header(x, ..., text_interpret = c(\"md\", \"html\"), quiet, update) show_header_names(x, include_example, quiet)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify column headers, footnotes, and spanning headers — modify","text":"x (gtsummary) gtsummary object ... dynamic-dots Used assign updates headers spanning headers. Use modify_*(colname='new header') update single column. Using formula invoke tidyselect, e.g. modify_*(all_stat_cols() ~ \"**{level}**\"). dynamic dots allow syntax like modify_header(x, !!!list(label = \"Variable\")). See examples . Use show_header_names() see column names can modified. text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}. update, quiet include_example","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify column headers, footnotes, and spanning headers — modify","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"tbl-summary-tbl-svysummary-and-tbl-cross-","dir":"Reference","previous_headings":"","what":"tbl_summary(), tbl_svysummary(), and tbl_cross()","title":"Modify column headers, footnotes, and spanning headers — modify","text":"assigning column headers spanning headers, may use {N} insert number observations. tbl_svysummary objects additionally {N_unweighted} available. stratifying = argument present, following fields additionally available stratifying columns: {level}, {n}, {p} ({n_unweighted} {p_unweighted} tbl_svysummary objects) Syntax follows glue::glue(), e.g. all_stat_cols() ~ \"**{level}**, N = {n}\".","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"tbl-regression-","dir":"Reference","previous_headings":"","what":"tbl_regression()","title":"Modify column headers, footnotes, and spanning headers — modify","text":"assigning column headers tbl_regression tables, may use {N} insert number observations, {N_event} number events (applicable).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Modify column headers, footnotes, and spanning headers — modify","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify column headers, footnotes, and spanning headers — modify","text":"","code":"# create summary table tbl <- trial |> tbl_summary(by = trt, missing = \"no\", include = c(\"age\", \"grade\", \"trt\")) |> add_p() # print the column names that can be modified show_header_names(tbl) #> Column Name Header level* N* n* p* #> label \"**Characteristic**\" 200 #> stat_1 \"**Drug A** \\nN = 98\" Drug A 200 98 0.490 #> stat_2 \"**Drug B** \\nN = 102\" Drug B 200 102 0.510 #> p.value \"**p-value**\" 200 #> #> * These values may be dynamically placed into headers (and other locations). #> ℹ Review the `modify_header()` (`?gtsummary::modify_header()`) help for #> examples. # Example 1 ---------------------------------- # updating column headers tbl |> modify_header(label = \"**Variable**\", p.value = \"**P**\") Variable Drug A N = 981 Drug B N = 1021 P2 Age 46 (37, 60) 48 (39, 56) 0.7Grade 0.9    I 35 (36%) 33 (32%)     II 32 (33%) 36 (35%)     III 31 (32%) 33 (32%) 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test; Pearson’s Chi-squared test # Example 2 ---------------------------------- # updating headers add spanning header tbl |> modify_header(all_stat_cols() ~ \"**{level}**, N = {n} ({style_percent(p)}%)\") |> modify_spanning_header(all_stat_cols() ~ \"**Treatment Received**\") Characteristic Treatment Received p-value2 Drug A, N = 98 (49%)1 Drug B, N = 102 (51%)1 Age 46 (37, 60) 48 (39, 56) 0.7Grade 0.9    I 35 (36%) 33 (32%)     II 32 (33%) 36 (35%)     III 31 (32%) 33 (32%) 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test; Pearson’s Chi-squared test # Example 3 ---------------------------------- # updating an abbreviation in table footnote glm(response ~ age + grade, trial, family = binomial) |> tbl_regression(exponentiate = TRUE) |> modify_abbreviation(\"CI = Credible Interval\") Characteristic OR 95% CI p-value Age 1.02 1.00, 1.04 0.10Grade     I — —     II 0.85 0.39, 1.85 0.7    III 1.01 0.47, 2.16 >0.9Abbreviations: CI = Confidence Interval, CI = Credible Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Abbreviations — modify_abbreviation","title":"Modify Abbreviations — modify_abbreviation","text":"abbreviations coalesced printing final table single source note.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Abbreviations — modify_abbreviation","text":"","code":"modify_abbreviation(x, abbreviation, text_interpret = c(\"md\", \"html\")) remove_abbreviation(x, abbreviation)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Abbreviations — modify_abbreviation","text":"x (gtsummary) gtsummary object abbreviation (string) string text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify Abbreviations — modify_abbreviation","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_abbreviation.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify Abbreviations — modify_abbreviation","text":"","code":"# Example 1 ---------------------------------- tbl_summary( trial, by = trt, include = age, type = age ~ \"continuous2\" ) |> modify_table_body(~dplyr::mutate(.x, label = sub(\"Q1, Q3\", \"IQR\", x = label))) |> modify_abbreviation(\"IQR = Interquartile Range\") Characteristic Drug A N = 98 Drug B N = 102 Age     Median (IQR) 46 (37, 60) 48 (39, 56)    Unknown 7 4Abbreviation: IQR = Interquartile Range # Example 2 ---------------------------------- lm(marker ~ trt, trial) |> tbl_regression() |> remove_abbreviation(\"CI = Confidence Interval\") Characteristic Beta 95% CI p-value Chemotherapy Treatment     Drug A — —     Drug B -0.20 -0.44, 0.05 0.12"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify table caption — modify_caption","title":"Modify table caption — modify_caption","text":"Captions assigned based output type. gt::gt(caption=) flextable::set_caption(caption=) huxtable::set_caption(value=) knitr::kable(caption=)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify table caption — modify_caption","text":"","code":"modify_caption(x, caption, text_interpret = c(\"md\", \"html\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify table caption — modify_caption","text":"x (gtsummary) gtsummary object caption (string) string table caption/title text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify table caption — modify_caption","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_caption.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify table caption — modify_caption","text":"Baseline Characteristics N = 200","code":"trial |> tbl_summary(by = trt, include = c(marker, stage)) |> modify_caption(caption = \"**Baseline Characteristics** N = {N}\") Baseline Characteristics N = 200 Characteristic Drug A N = 981 Drug B N = 1021 Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21)    Unknown 6 4T Stage     T1 28 (29%) 25 (25%)    T2 25 (26%) 29 (28%)    T3 22 (22%) 21 (21%)    T4 23 (23%) 27 (26%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_alignment.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify column alignment — modify_column_alignment","title":"Modify column alignment — modify_column_alignment","text":"Update column alignment/justification gtsummary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_alignment.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify column alignment — modify_column_alignment","text":"","code":"modify_column_alignment(x, columns, align = c(\"left\", \"right\", \"center\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_alignment.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify column alignment — modify_column_alignment","text":"x (gtsummary) gtsummary object columns (tidy-select) Selector columns x$table_body align (string) String indicating alignment column, must one c(\"left\", \"right\", \"center\")","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_alignment.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify column alignment — modify_column_alignment","text":"","code":"# Example 1 ---------------------------------- lm(age ~ marker + grade, trial) %>% tbl_regression() %>% modify_column_alignment(columns = everything(), align = \"left\") Characteristic Beta 95% CI p-value Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9Grade     I — —     II 0.64 -4.7, 6.0 0.8    III 2.4 -2.8, 7.6 0.4Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify hidden columns — modify_column_hide","title":"Modify hidden columns — modify_column_hide","text":"Use functions hide unhide columns gtsummary table. Use show_header_names(show_hidden=TRUE) print available columns update.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify hidden columns — modify_column_hide","text":"","code":"modify_column_hide(x, columns) modify_column_unhide(x, columns)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify hidden columns — modify_column_hide","text":"x (gtsummary) gtsummary object columns (tidy-select) Selector columns x$table_body","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Modify hidden columns — modify_column_hide","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_hide.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify hidden columns — modify_column_hide","text":"","code":"# Example 1 ---------------------------------- # hide 95% CI, and replace with standard error lm(age ~ marker + grade, trial) |> tbl_regression() |> modify_column_hide(conf.low) |> modify_column_unhide(columns = std.error) Characteristic Beta SE p-value Marker Level (ng/mL) -0.04 1.28 >0.9Grade     I — —     II 0.64 2.70 0.8    III 2.4 2.64 0.4Abbreviations: CI = Confidence Interval, SE = Standard Error"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify column indentation — modify_column_indent","title":"Modify column indentation — modify_column_indent","text":"Add, increase, reduce indentation columns.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify column indentation — modify_column_indent","text":"","code":"modify_column_indent(x, columns, rows = NULL, indent = 4L, double_indent, undo)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify column indentation — modify_column_indent","text":"x (gtsummary) gtsummary object columns (tidy-select) Selector columns x$table_body rows (predicate expression) Predicate expression select rows x$table_body. Can used style footnote, formatting functions, missing symbols, text formatting. Default NULL. See details . indent (integer) integer indicating many space indent text double_indent, undo","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify column indentation — modify_column_indent","text":"gtsummary table","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_indent.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify column indentation — modify_column_indent","text":"","code":"# remove indentation from `tbl_summary()` trial |> tbl_summary(include = grade) |> modify_column_indent(columns = label, indent = 0L) Characteristic N = 2001 Grade I 68 (34%)II 68 (34%)III 64 (32%)1 n (%) # increase indentation in `tbl_summary` trial |> tbl_summary(include = grade) |> modify_column_indent(columns = label, rows = !row_type %in% 'label', indent = 8L) Characteristic N = 2001 Grade         I 68 (34%)        II 68 (34%)        III 64 (32%)1 n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Column Merging — modify_column_merge","title":"Modify Column Merging — modify_column_merge","text":"Merge two columns gtsummary table. Use show_header_names() print underlying column names.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Column Merging — modify_column_merge","text":"","code":"modify_column_merge(x, pattern, rows = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Column Merging — modify_column_merge","text":"x (gtsummary) gtsummary object pattern glue syntax string indicating merge columns x$table_body. example, construct confidence interval use \"{conf.low}, {conf.high}\". rows (predicate expression) Predicate expression select rows x$table_body. Can used style footnote, formatting functions, missing symbols, text formatting. Default NULL. See details .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify Column Merging — modify_column_merge","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify Column Merging — modify_column_merge","text":"Calling function merely records instructions merge columns. actual merging occurs gtsummary table printed converted function like as_gt(). column merging delayed, recommended perform major modifications table, tbl_merge() tbl_stack(), assigning merging instructions. Otherwise, unexpected formatting may occur final table. functionality used conjunction tbl_stack() (includes tbl_uvregression()), may potential issues printing. columns stack column-merging defined quosure, may run issues due loss environment 2 quosures combined. expression version quosure quosure (.e. evaluated objects), issues. function used internally care, recommended users.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"future-updates","dir":"Reference","previous_headings":"","what":"Future Updates","title":"Modify Column Merging — modify_column_merge","text":"planned updates implementation function respect pattern= argument. Currently, function replaces numeric column formatted character column following pattern=. gt::cols_merge() gains rows= argument implementation updated use , keep numeric columns numeric. vast majority users, planned change go unnoticed.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_column_merge.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify Column Merging — modify_column_merge","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, missing = \"no\", include = c(age, marker, trt)) |> add_p(all_continuous() ~ \"t.test\", pvalue_fun = label_style_pvalue(prepend_p = TRUE)) |> modify_fmt_fun(statistic ~ label_style_sigfig()) |> modify_column_merge(pattern = \"t = {statistic}; {p.value}\") |> modify_header(statistic = \"**t-test**\") Characteristic Drug A N = 981 Drug B N = 1021 t-test2 Age 46 (37, 60) 48 (39, 56) t = -0.21; p=0.8Marker Level (ng/mL) 0.84 (0.23, 1.60) 0.52 (0.18, 1.21) t = 1.6; p=0.121 Median (Q1, Q3) 2 Welch Two Sample t-test # Example 2 ---------------------------------- lm(marker ~ age + grade, trial) |> tbl_regression() |> modify_column_merge( pattern = \"{estimate} ({conf.low}, {conf.high})\", rows = !is.na(estimate) ) Characteristic Beta p-value Age 0.00 (-0.01, 0.01) >0.9Grade     I —     II -0.38 (-0.69, -0.07) 0.015    III -0.12 (-0.43, 0.19) 0.5Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify formatting functions — modify_fmt_fun","title":"Modify formatting functions — modify_fmt_fun","text":"Use function update way numeric columns rows .$table_body formatted","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify formatting functions — modify_fmt_fun","text":"","code":"modify_fmt_fun(x, ..., rows = NULL, update, quiet)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify formatting functions — modify_fmt_fun","text":"x (gtsummary) gtsummary object ... dynamic-dots Used assign updates formatting functions. Use modify_fmt_fun(colname = ) update single column. Using formula invoke tidyselect, e.g. modify_fmt_fun(c(estimate, conf.low, conf.high) ~ ). Use show_header_names() see column names can modified. rows (predicate expression) Predicate expression select rows x$table_body. Can used style footnote, formatting functions, missing symbols, text formatting. Default NULL. See details . update, quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":"rows-argument","dir":"Reference","previous_headings":"","what":"rows argument","title":"Modify formatting functions — modify_fmt_fun","text":"rows argument accepts predicate expression used specify rows apply formatting. expression must evaluate logical evaluated x$table_body. example, apply formatting age rows pass rows = variable == \"age\". vector row numbers acceptable. couple things note using rows argument. can use saved objects create predicate argument, e.g. rows = variable == letters[1]. saved object share name column x$table_body. reason tbl_merge() columns renamed, renaming process disambiguate variable column external object named variable following expression rows = .data$variable = .env$variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_fmt_fun.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify formatting functions — modify_fmt_fun","text":"","code":"# Example 1 ---------------------------------- # show 'grade' p-values to 3 decimal places and estimates to 4 sig figs lm(age ~ marker + grade, trial) |> tbl_regression() %>% modify_fmt_fun( p.value = label_style_pvalue(digits = 3), c(estimate, conf.low, conf.high) ~ label_style_sigfig(digits = 4), rows = variable == \"grade\" ) Characteristic Beta 95% CI p-value Marker Level (ng/mL) -0.04 -2.6, 2.5 >0.9Grade     I — —     II 0.6365 -4.684, 5.957 0.814    III 2.394 -2.822, 7.610 0.366Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Footnotes — modify_footnote2","title":"Modify Footnotes — modify_footnote2","text":"Modify Footnotes","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Footnotes — modify_footnote2","text":"","code":"modify_footnote_header( x, footnote, columns, replace = TRUE, text_interpret = c(\"md\", \"html\") ) modify_footnote_body( x, footnote, columns, rows, replace = TRUE, text_interpret = c(\"md\", \"html\") ) remove_footnote_header(x, columns) remove_footnote_body(x, columns, rows)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Footnotes — modify_footnote2","text":"x (gtsummary) gtsummary object footnote (string) string columns (tidy-select) columns add footnote replace (scalar logical) Logical indicating whether replace existing footnotes specified location specified footnote, whether specified added existing footnote(s) header/cell. Default replace existing footnotes. text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}. rows (predicate expression) Predicate expression select rows x$table_body. Review rows argument details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify Footnotes — modify_footnote2","text":"Updated gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_footnote2.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify Footnotes — modify_footnote2","text":"","code":"# Example 1 ---------------------------------- tbl <- trial |> tbl_summary(by = trt, include = c(age, grade), missing = \"no\") |> modify_footnote_header( footnote = \"All but four subjects received both treatments in a crossover design\", columns = all_stat_cols(), replace = FALSE ) |> modify_footnote_body( footnote = \"Tumor grade was assessed _before_ treatment began\", columns = \"label\", rows = variable == \"grade\" & row_type == \"label\" ) tbl Characteristic Drug A N = 981,2 Drug B N = 1021,2 Age 46 (37, 60) 48 (39, 56)Grade3     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)1 Median (Q1, Q3); n (%) 2 All but four subjects received both treatments in a crossover design 3 Tumor grade was assessed before treatment began # Example 2 ---------------------------------- # remove all footnotes tbl |> remove_footnote_header(columns = all_stat_cols()) |> remove_footnote_body(columns = label, rows = variable == \"grade\" & row_type == \"label\") Characteristic Drug A N = 98 Drug B N = 102 Age 46 (37, 60) 48 (39, 56)Grade     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify source note — modify_source_note","title":"Modify source note — modify_source_note","text":"Add remove source notes table. Source notes similar footnotes, expect linked cell table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify source note — modify_source_note","text":"","code":"modify_source_note(x, source_note, text_interpret = c(\"md\", \"html\")) remove_source_note(x, source_note_id)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify source note — modify_source_note","text":"x (gtsummary) gtsummary object. source_note (string) string add source note. text_interpret (string) String indicates whether text interpreted gt::md() gt::html(). Must \"md\" (default) \"html\". Applies tables printed {gt}. source_note_id (integers) Integers specifying ID source note remove. Source notes indexed sequentially time creation.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify source note — modify_source_note","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Modify source note — modify_source_note","text":"Source notes supported as_kable_extra().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_source_note.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify source note — modify_source_note","text":"","code":"# Example 1 ---------------------------------- tbl <- tbl_summary(trial, include = c(marker, grade), missing = \"no\") |> modify_source_note(\"Results as of June 26, 2015\") # Example 2 ---------------------------------- remove_source_note(tbl, source_note_id = 1) Characteristic N = 2001 Marker Level (ng/mL) 0.64 (0.22, 1.41)Grade     I 68 (34%)    II 68 (34%)    III 64 (32%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Table Body — modify_table_body","title":"Modify Table Body — modify_table_body","text":"Function advanced manipulation gtsummary tables. allow users modify .$table_body data frame included gtsummary object. new column added table, default printing instructions added .$table_styling. default, columns hidden. show column, add column header modify_header() call modify_column_unhide().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Table Body — modify_table_body","text":"","code":"modify_table_body(x, fun, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Table Body — modify_table_body","text":"x (gtsummary) 'gtsummary' object fun (function) function formula. function, used . formula, e.g. fun = ~ .x |> arrange(variable), converted function. argument passed fun x$table_body. ... Additional arguments passed function","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Modify Table Body — modify_table_body","text":"'gtsummary' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_body.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Modify Table Body — modify_table_body","text":"","code":"# Example 1 -------------------------------- # Add number of cases and controls to regression table trial |> tbl_uvregression( y = response, include = c(age, marker), method = glm, method.args = list(family = binomial), exponentiate = TRUE, hide_n = TRUE ) |> # adding number of non-events to table modify_table_body( ~ .x %>% dplyr::mutate(N_nonevent = N_obs - N_event) |> dplyr::relocate(c(N_event, N_nonevent), .before = estimate) ) |> # assigning header labels modify_header(N_nonevent = \"**Control N**\", N_event = \"**Case N**\") |> modify_fmt_fun(c(N_event, N_nonevent) ~ style_number) Characteristic Case N Control N OR 95% CI p-value Age 58 125 1.02 1.00, 1.04 0.10Marker Level (ng/mL) 57 126 1.35 0.94, 1.93 0.10Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":null,"dir":"Reference","previous_headings":"","what":"Modify Table Styling — modify_table_styling","title":"Modify Table Styling — modify_table_styling","text":"function developers. developer, recommended use following functions make modifications table. modify_header(), modify_spanning_header(), [modify_column_hide()], modify_column_unhide(), modify_footnote_header(), modify_footnote_body(), modify_abbreviation(), modify_column_alignment(), modify_fmt_fun(), [modify_column_indent()], modify_column_merge(). function meant advanced users gain control characteristics resulting gtsummary table directly modifying .$table_styling. function little checking passed arguments. Review gtsummary definition vignette information .$table_styling objects.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Modify Table Styling — modify_table_styling","text":"","code":"modify_table_styling( x, columns, rows = NULL, label = NULL, spanning_header = NULL, hide = NULL, footnote = NULL, footnote_abbrev = NULL, align = NULL, missing_symbol = NULL, fmt_fun = NULL, text_format = NULL, undo_text_format = NULL, indent = NULL, text_interpret = \"md\", cols_merge_pattern = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Modify Table Styling — modify_table_styling","text":"x (gtsummary) gtsummary object columns (tidy-select) Selector columns x$table_body rows (predicate expression) Predicate expression select rows x$table_body. Can used style footnote, formatting functions, missing symbols, text formatting. Default NULL. See details . label (character) Character vector column label(s). Must length columns. spanning_header (string) string text spanning header hide (scalar logical) Logical indicating whether hide column output footnote (string) string text footnote footnote_abbrev (string) string abbreviation definition, e.g. \"CI = Confidence Interval\" align (string) String indicating alignment column, must one c(\"left\", \"right\", \"center\") missing_symbol (string) string indicating missing values formatted. fmt_fun (function) function formats statistics columns/rows columns rows text_format, undo_text_format (string) String indicated type text formatting apply/remove rows columns. Must one c(\"bold\", \"italic\"). indent (integer) integer indicating many space indent text text_interpret (string) Must one \"md\" \"html\" indicates processing function gt::md() gt::html(). Use conjunction arguments header footnotes. cols_merge_pattern (string) glue-syntax string indicating merge columns x$table_body. example, construct confidence interval use \"{conf.low}, {conf.high}\". first column listed pattern string must match single column name passed columns=.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":"rows-argument","dir":"Reference","previous_headings":"","what":"rows argument","title":"Modify Table Styling — modify_table_styling","text":"rows argument accepts predicate expression used specify rows apply formatting. expression must evaluate logical evaluated x$table_body. example, apply formatting age rows pass rows = variable == \"age\". vector row numbers acceptable. couple things note using rows argument. can use saved objects create predicate argument, e.g. rows = variable == letters[1]. saved object share name column x$table_body. reason tbl_merge() columns renamed, renaming process disambiguate variable column external object named variable following expression rows = .data$variable = .env$variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/modify_table_styling.html","id":"cols-merge-pattern-argument","dir":"Reference","previous_headings":"","what":"cols_merge_pattern argument","title":"Modify Table Styling — modify_table_styling","text":"planned updates implementation column merging. Currently, function replaces numeric column formatted character column following cols_merge_pattern=. gt::cols_merge() gains rows= argument implementation updated use , keep numeric columns numeric. vast majority users, planned change go unnoticed. functionality used conjunction tbl_stack() (includes tbl_uvregression()), potential issue printing. columns stack column-merging defined quosure, may run issues due loss environment 2 quosures combined. expression version quosure quosure (.e. evaluated objects), issues. Regardless, argument used internally care, recommended users.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Regression Coefficients — plot","title":"Plot Regression Coefficients — plot","text":"plot() function extracts x$table_body passes ggstats::ggcoef_plot() along formatting options.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Regression Coefficients — plot","text":"","code":"# S3 method for class 'tbl_regression' plot(x, remove_header_rows = TRUE, remove_reference_rows = FALSE, ...) # S3 method for class 'tbl_uvregression' plot(x, remove_header_rows = TRUE, remove_reference_rows = FALSE, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Regression Coefficients — plot","text":"x (tbl_regression, tbl_uvregression) 'tbl_regression' 'tbl_uvregression' object remove_header_rows (scalar logical) logical indicating whether remove header rows categorical variables. Default TRUE remove_reference_rows (scalar logical) logical indicating whether remove reference rows categorical variables. Default FALSE. ... arguments passed ggstats::ggcoef_plot(...)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot Regression Coefficients — plot","text":"ggplot","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/plot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Regression Coefficients — plot","text":"","code":"glm(response ~ marker + grade, trial, family = binomial) |> tbl_regression( add_estimate_to_reference_rows = TRUE, exponentiate = TRUE ) |> plot()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/print_gtsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"print and knit_print methods for gtsummary objects — print_gtsummary","title":"print and knit_print methods for gtsummary objects — print_gtsummary","text":"print knit_print methods gtsummary objects","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/print_gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"print and knit_print methods for gtsummary objects — print_gtsummary","text":"","code":"# S3 method for class 'gtsummary' print( x, print_engine = c(\"gt\", \"flextable\", \"huxtable\", \"kable\", \"kable_extra\", \"tibble\"), ... ) # S3 method for class 'gtsummary' knit_print( x, print_engine = c(\"gt\", \"flextable\", \"huxtable\", \"kable\", \"kable_extra\", \"tibble\"), ... ) pkgdown_print.gtsummary(x, visible = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/print_gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"print and knit_print methods for gtsummary objects — print_gtsummary","text":"x object created using gtsummary functions print_engine String indicating print method. Must one \"gt\", \"kable\", \"kable_extra\", \"flextable\", \"tibble\" ... used","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/print_gtsummary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"print and knit_print methods for gtsummary objects — print_gtsummary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize a proportion — proportion_summary","title":"Summarize a proportion — proportion_summary","text":"helper, used tbl_custom_summary(), creates function computing proportion confidence interval.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize a proportion — proportion_summary","text":"","code":"proportion_summary( variable, value, weights = NULL, na.rm = TRUE, conf.level = 0.95, method = c(\"wilson\", \"wilson.no.correct\", \"wald\", \"wald.no.correct\", \"exact\", \"agresti.coull\", \"jeffreys\") )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize a proportion — proportion_summary","text":"variable (string) String indicating name variable proportion computed. value (scalar) Value (list values) variable taken account numerator. weights (string) Optional string indicating name frequency weighting variable. NULL, observations assumed weight equal 1. na.rm (scalar logical) missing values removed computing proportion? (default TRUE) conf.level (scalar numeric) Confidence level returned confidence interval. Must strictly greater 0 less 1. Default 0.95, corresponds 95 percent confidence interval. method (string) Confidence interval method. Must one c(\"wilson\", \"wilson..correct\", \"wald\", \"wald..correct\", \"exact\", \"agresti.coull\", \"jeffreys\"). See add_ci() details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Summarize a proportion — proportion_summary","text":"Computed statistics: {n} numerator, number observations equal values {N} denominator, number observations {prop} proportion, .e. n/N {conf.low} lower confidence interval {conf.high} upper confidence interval Methods c(\"wilson\", \"wilson..correct\") calculated stats::prop.test() (correct = c(TRUE, FALSE)). default method, \"wilson\", includes Yates continuity correction. Methods c(\"exact\", \"asymptotic\") calculated Hmisc::binconf() corresponding method.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summarize a proportion — proportion_summary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/proportion_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize a proportion — proportion_summary","text":"","code":"# Example 1 ---------------------------------- Titanic |> as.data.frame() |> tbl_custom_summary( include = c(\"Age\", \"Class\"), by = \"Sex\", stat_fns = ~ proportion_summary(\"Survived\", \"Yes\", weights = \"Freq\"), statistic = ~ \"{prop}% ({n}/{N}) [{conf.low}-{conf.high}]\", digits = ~ list( prop = label_style_percent(digits = 1), n = 0, N = 0, conf.low = label_style_percent(), conf.high = label_style_percent() ), overall_row = TRUE, overall_row_last = TRUE ) |> bold_labels() |> modify_footnote_header(\"Proportion (%) of survivors (n/N) [95% CI]\", columns = all_stat_cols()) Characteristic Male N = 161 Female N = 161 Age     Child 45.3% (29/64) [33-58] 62.2% (28/45) [47-76]    Adult 20.3% (338/1,667) [18-22] 74.4% (316/425) [70-78]Class     1st 34.4% (62/180) [28-42] 97.2% (141/145) [93-99]    2nd 14.0% (25/179) [9.4-20] 87.7% (93/106) [80-93]    3rd 17.3% (88/510) [14-21] 45.9% (90/196) [39-53]    Crew 22.3% (192/862) [20-25] 87.0% (20/23) [65-97]Overall 21.2% (367/1,731) [19-23] 73.2% (344/470) [69-77]1 Proportion (%) of survivors (n/N) [95% CI]"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize the ratio of two variables — ratio_summary","title":"Summarize the ratio of two variables — ratio_summary","text":"helper, used tbl_custom_summary(), creates function computing ratio two continuous variables confidence interval.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize the ratio of two variables — ratio_summary","text":"","code":"ratio_summary(numerator, denominator, na.rm = TRUE, conf.level = 0.95)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize the ratio of two variables — ratio_summary","text":"numerator (string) String indicating name variable summed computing numerator. denominator (string) String indicating name variable summed computing denominator. na.rm (scalar logical) missing values removed summing numerator denominator? (default TRUE) conf.level (scalar numeric) Confidence level returned confidence interval. Must strictly greater 0 less 1. Default 0.95, corresponds 95 percent confidence interval.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Summarize the ratio of two variables — ratio_summary","text":"Computed statistics: {num} sum variable defined numerator {denom} sum variable defined denominator {ratio} ratio num denom {conf.low} lower confidence interval {conf.high} upper confidence interval Confidence interval computed stats::poisson.test(), num integer.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summarize the ratio of two variables — ratio_summary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/ratio_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize the ratio of two variables — ratio_summary","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_custom_summary( include = c(\"stage\", \"grade\"), by = \"trt\", stat_fns = ~ ratio_summary(\"response\", \"ttdeath\"), statistic = ~\"{ratio} [{conf.low}; {conf.high}] ({num}/{denom})\", digits = ~ c(ratio = 3, conf.low = 2, conf.high = 2), overall_row = TRUE, overall_row_label = \"All stages & grades\" ) |> bold_labels() |> modify_footnote_header(\"Ratio [95% CI] (n/N)\", columns = all_stat_cols()) Characteristic Drug A N = 981 Drug B N = 1021 All stages & grades 0.014 [0.01; 0.02] (28.0000/1,983.0000) 0.017 [0.01; 0.02] (33.0000/1,941.6100)T Stage     T1 0.012 [0.00; 0.02] (7/583) 0.021 [0.01; 0.04] (11/522)    T2 0.011 [0.00; 0.02] (6/528) 0.012 [0.01; 0.03] (7/560)    T3 0.019 [0.01; 0.04] (8/426) 0.016 [0.01; 0.03] (7/425)    T4 0.016 [0.01; 0.03] (7/445) 0.018 [0.01; 0.04] (8/434)Grade     I 0.011 [0.00; 0.02] (8/734) 0.019 [0.01; 0.03] (13/690)    II 0.011 [0.00; 0.02] (7/651) 0.019 [0.01; 0.03] (12/645)    III 0.022 [0.01; 0.04] (13/598) 0.013 [0.01; 0.03] (8/607)1 Ratio [95% CI] (n/N)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/reexports.html","id":null,"dir":"Reference","previous_headings":"","what":"Objects exported from other packages — reexports","title":"Objects exported from other packages — reexports","text":"objects imported packages. Follow links see documentation. dplyr %>%, all_of, any_of, as_tibble, contains, ends_with, everything, last_col, matches, mutate, num_range, one_of, select, starts_with, vars, ","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":null,"dir":"Reference","previous_headings":"","what":"Remove rows — remove_row_type","title":"Remove rows — remove_row_type","text":"Removes either header, reference, missing rows gtsummary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Remove rows — remove_row_type","text":"","code":"remove_row_type( x, variables = everything(), type = c(\"header\", \"reference\", \"missing\", \"level\", \"all\"), level_value = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Remove rows — remove_row_type","text":"x (gtsummary) gtsummary object variables (tidy-select) Variables remove rows . Default everything() type (string) Type row remove. Must one c(\"header\", \"reference\", \"missing\", \"level\", \"\") level_value (string) type='level' can specify character value level remove. NULL levels removed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Remove rows — remove_row_type","text":"Modified gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/remove_row_type.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Remove rows — remove_row_type","text":"","code":"# Example 1 ---------------------------------- trial |> dplyr::mutate( age60 = ifelse(age < 60, \"<60\", \"60+\") ) |> tbl_summary(by = trt, missing = \"no\", include = c(trt, age, age60)) |> remove_row_type(age60, type = \"header\") Characteristic Drug A N = 981 Drug B N = 1021 Age 46 (37, 60) 48 (39, 56)    60+ 23 (25%) 18 (18%)    <60 68 (75%) 80 (82%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/rows_argument.html","id":null,"dir":"Reference","previous_headings":"","what":"rows argument — rows_argument","title":"rows argument — rows_argument","text":"rows argument accepts predicate expression used specify rows apply formatting. expression must evaluate logical evaluated x$table_body. example, apply formatting age rows pass rows = variable == \"age\". vector row numbers acceptable. couple things note using rows argument. can use saved objects create predicate argument, e.g. rows = variable == letters[1]. saved object share name column x$table_body. reason tbl_merge() columns renamed, renaming process disambiguate variable column external object named variable following expression rows = .data$variable = .env$variable.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"scope-table-body-","dir":"Reference","previous_headings":"","what":"scope_table_body()","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"function uses information .$table_body adds attributes data (passed). assigned proper gtsummary attributes, gtsummary selectors like all_continuous() work properly. Columns c(\"var_type\", \"test_name\", \"contrasts_type\") columns begin \"selector_*\" scoped. values columns added attributes data frame. example, var_type='continuous' variable \"age\", attribute attr(.$age, 'gtsummary.var_type') <- 'continuous' set. attribute used selector like all_continuous().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"scope-header-","dir":"Reference","previous_headings":"","what":"scope_header()","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"function takes information .$table_styling$header adds table_body. Columns begin 'modify_selector_' hide column.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"","code":"scope_table_body(table_body, data = NULL) scope_header(table_body, header = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"table_body data frame .$table_body data optional data frame attributes added header header data frame .$table_styling$header","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"data frame","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/scoping_gtsummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Scoping for Table Body and Header — scoping_gtsummary","text":"","code":"tbl <- tbl_summary(trial, include = c(age, grade)) scope_table_body(tbl$table_body) |> select(all_continuous()) |> names() #> [1] \"age\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":null,"dir":"Reference","previous_headings":"","what":"Select helper functions — select_helpers","title":"Select helper functions — select_helpers","text":"Set functions supplement {tidyselect} set functions selecting columns data frames (items well). all_continuous() selects continuous variables all_continuous2() selects type \"continuous2\" all_categorical() selects categorical (including \"dichotomous\") variables all_dichotomous() selects type \"dichotomous\" all_tests() selects variables name test performed all_stat_cols() selects columns tbl_summary/tbl_svysummary object summary statistics (.e. \"stat_0\", \"stat_1\", \"stat_2\", etc.) all_interaction() selects interaction terms regression model all_intercepts() selects intercept terms regression model all_contrasts() selects variables regression model based type contrast","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Select helper functions — select_helpers","text":"","code":"all_continuous(continuous2 = TRUE) all_continuous2() all_categorical(dichotomous = TRUE) all_dichotomous() all_tests(tests) all_intercepts() all_interaction() all_contrasts( contrasts_type = c(\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdif\", \"other\") ) all_stat_cols(stat_0 = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Select helper functions — select_helpers","text":"continuous2 (scalar logical) Logical indicating whether include continuous2 variables. Default TRUE dichotomous (scalar logical) Logical indicating whether include dichotomous variables. Default TRUE tests (character) character vector indicating test type variables select, e.g. select variables compared \"t.test\". contrasts_type (character) type contrast select. Select among contrast types c(\"treatment\", \"sum\", \"poly\", \"helmert\", \"sdif\", \"\"). Default contrast types. stat_0 (scalar logical) FALSE, select \"stat_0\" column. Default TRUE","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Select helper functions — select_helpers","text":"character vector column names selected","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/select_helpers.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Select helper functions — select_helpers","text":"","code":"select_ex1 <- trial |> select(age, response, grade) |> tbl_summary( statistic = all_continuous() ~ \"{mean} ({sd})\", type = all_dichotomous() ~ \"categorical\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/separate_p_footnotes.html","id":null,"dir":"Reference","previous_headings":"","what":"Create footnotes for individual p-values — separate_p_footnotes","title":"Create footnotes for individual p-values — separate_p_footnotes","text":"usual presentation footnotes p-values gtsummary table single footnote lists statistical tests used compute p-values given table. separate_p_footnotes() function separates aggregated p-value footnotes individual footnotes denote specific test used p-values.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/separate_p_footnotes.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create footnotes for individual p-values — separate_p_footnotes","text":"","code":"separate_p_footnotes(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/separate_p_footnotes.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create footnotes for individual p-values — separate_p_footnotes","text":"x (tbl_summary, tbl_svysummary) Object class \"tbl_summary\" \"tbl_svysummary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/separate_p_footnotes.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create footnotes for individual p-values — separate_p_footnotes","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_summary(by = trt, include = c(age, grade)) |> add_p() |> separate_p_footnotes() Characteristic Drug A N = 981 Drug B N = 1021 p-value Age 46 (37, 60) 48 (39, 56) 0.72    Unknown 7 4 Grade 0.93    I 35 (36%) 33 (32%)     II 32 (33%) 36 (35%)     III 31 (32%) 33 (32%) 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test 3 Pearson’s Chi-squared test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":null,"dir":"Reference","previous_headings":"","what":"Set gtsummary theme — set_gtsummary_theme","title":"Set gtsummary theme — set_gtsummary_theme","text":"Functions set, reset, get, evaluate gtsummary themes. set_gtsummary_theme() set theme reset_gtsummary_theme() reset themes get_gtsummary_theme() get named list active theme elements with_gtsummary_theme() evaluate expression theme temporarily set check_gtsummary_theme() checks passed theme valid","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Set gtsummary theme — set_gtsummary_theme","text":"","code":"set_gtsummary_theme(x, quiet) reset_gtsummary_theme() get_gtsummary_theme() with_gtsummary_theme( x, expr, env = rlang::caller_env(), msg_ignored_elements = NULL ) check_gtsummary_theme(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Set gtsummary theme — set_gtsummary_theme","text":"x (named list) named list defining gtsummary theme. quiet expr (expression) Expression evaluated theme specified x= loaded env (environment) environment evaluate expr= msg_ignored_elements (string) Default NULL message printed. Pass string printed cli::cli_alert_info(). \"{elements}\" object contains vector theme elements overwritten ignored.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Set gtsummary theme — set_gtsummary_theme","text":"default formatting styling throughout gtsummary package taken published reporting guidelines top four urology journals: European Urology, Journal Urology, Urology British Journal Urology International. Use function change default reporting style match another journal, personal style.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/set_gtsummary_theme.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Set gtsummary theme — set_gtsummary_theme","text":"","code":"# Setting JAMA theme for gtsummary set_gtsummary_theme(theme_gtsummary_journal(\"jama\")) #> Setting theme \"JAMA\" #> Setting theme \"JAMA\" # Themes can be combined by including more than one set_gtsummary_theme(theme_gtsummary_compact()) #> Setting theme \"Compact\" #> Setting theme \"Compact\" set_gtsummary_theme_ex1 <- trial |> tbl_summary(by = trt, include = c(age, grade, trt)) |> add_stat_label() |> as_gt() #> `add_stat_label()` has previously been applied. Returning gtsummary table #> unaltered. # reset gtsummary theme reset_gtsummary_theme()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":null,"dir":"Reference","previous_headings":"","what":"Sort/filter by p-values — sort_filter_p","title":"Sort/filter by p-values — sort_filter_p","text":"Sort/filter p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Sort/filter by p-values — sort_filter_p","text":"","code":"sort_p(x, q = FALSE) filter_p(x, q = FALSE, t = 0.05)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Sort/filter by p-values — sort_filter_p","text":"x (gtsummary) object created using gtsummary functions q (scalar logical) TRUE check q-value column rather p-value. Default FALSE. t (scalar numeric) Threshold values retained. Default 0.05.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Sort/filter by p-values — sort_filter_p","text":"Karissa Whiting, Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/sort_filter_p.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Sort/filter by p-values — sort_filter_p","text":"","code":"# Example 1 ---------------------------------- trial %>% select(age, grade, response, trt) %>% tbl_summary(by = trt) %>% add_p() %>% filter_p(t = 0.8) %>% sort_p() Characteristic Drug A N = 981 Drug B N = 1021 p-value2 Tumor Response 28 (29%) 33 (34%) 0.5    Unknown 3 4 Age 46 (37, 60) 48 (39, 56) 0.7    Unknown 7 4 1 Median (Q1, Q3); n (%) 2 Wilcoxon rank sum test; Pearson’s Chi-squared test # Example 2 ---------------------------------- glm(response ~ trt + grade, trial, family = binomial(link = \"logit\")) %>% tbl_regression(exponentiate = TRUE) %>% sort_p() Characteristic OR 95% CI p-value Chemotherapy Treatment     Drug A — —     Drug B 1.21 0.66, 2.24 0.5Grade     I — —     II 0.94 0.44, 1.98 0.9    III 1.09 0.52, 2.27 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":null,"dir":"Reference","previous_headings":"","what":"Style numbers — style_number","title":"Style numbers — style_number","text":"Style numbers","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style numbers — style_number","text":"","code":"style_number( x, digits = 0, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), scale = 1, prefix = \"\", suffix = \"\", ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style numbers — style_number","text":"x (numeric) Numeric vector digits (non-negative integer) Integer vector integers specifying number decimals round x. vector passed, integer mapped 1:1 numeric values x big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") scale (scalar numeric) scaling factor: x multiplied scale formatting. prefix (string) Additional text display number. suffix (string) Additional text display number. ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style numbers — style_number","text":"formatted character vector","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_number.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style numbers — style_number","text":"","code":"c(0.111, 12.3) |> style_number(digits = 1) #> [1] \"0.1\" \"12.3\" c(0.111, 12.3) |> style_number(digits = c(1, 0)) #> [1] \"0.1\" \"12\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":null,"dir":"Reference","previous_headings":"","what":"Style percentages — style_percent","title":"Style percentages — style_percent","text":"Style percentages","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style percentages — style_percent","text":"","code":"style_percent( x, digits = 0, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", symbol, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style percentages — style_percent","text":"x numeric vector percentages digits number digits round large percentages (.e. greater 10%). Smaller percentages rounded digits + 1 places. Default 0 big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") prefix (string) Additional text display number. suffix (string) Additional text display number. symbol Logical indicator include percent symbol output. Default FALSE. ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style percentages — style_percent","text":"character vector styled percentages","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Style percentages — style_percent","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_percent.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style percentages — style_percent","text":"","code":"percent_vals <- c(-1, 0, 0.0001, 0.005, 0.01, 0.10, 0.45356, 0.99, 1.45) style_percent(percent_vals) #> [1] NA \"0\" \"<0.1\" \"0.5\" \"1.0\" \"10\" \"45\" \"99\" \"145\" style_percent(percent_vals, suffix = \"%\", digits = 1) #> [1] NA \"0%\" \"0.01%\" \"0.50%\" \"1.00%\" \"10.0%\" \"45.4%\" \"99.0%\" #> [9] \"145.0%\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":null,"dir":"Reference","previous_headings":"","what":"Style p-values — style_pvalue","title":"Style p-values — style_pvalue","text":"Style p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style p-values — style_pvalue","text":"","code":"style_pvalue( x, digits = 1, prepend_p = FALSE, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style p-values — style_pvalue","text":"x (numeric) Numeric vector p-values. digits (integer) Number digits large p-values rounded. Must 1, 2, 3. Default 1. prepend_p (scalar logical) Logical. 'p=' prepended formatted p-value. Default FALSE big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style p-values — style_pvalue","text":"character vector styled p-values","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Style p-values — style_pvalue","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_pvalue.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style p-values — style_pvalue","text":"","code":"pvals <- c( 1.5, 1, 0.999, 0.5, 0.25, 0.2, 0.197, 0.12, 0.10, 0.0999, 0.06, 0.03, 0.002, 0.001, 0.00099, 0.0002, 0.00002, -1 ) style_pvalue(pvals) #> [1] NA \">0.9\" \">0.9\" \"0.5\" \"0.3\" \"0.2\" \"0.2\" \"0.12\" #> [9] \"0.10\" \"0.10\" \"0.060\" \"0.030\" \"0.002\" \"0.001\" \"<0.001\" \"<0.001\" #> [17] \"<0.001\" NA style_pvalue(pvals, digits = 2, prepend_p = TRUE) #> [1] NA \"p>0.99\" \"p>0.99\" \"p=0.50\" \"p=0.25\" \"p=0.20\" \"p=0.20\" #> [8] \"p=0.12\" \"p=0.10\" \"p=0.10\" \"p=0.060\" \"p=0.030\" \"p=0.002\" \"p=0.001\" #> [15] \"p<0.001\" \"p<0.001\" \"p<0.001\" NA"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":null,"dir":"Reference","previous_headings":"","what":"Style ratios — style_ratio","title":"Style ratios — style_ratio","text":"reporting ratios, relative risk odds ratio, often want rounding similar side number 1. example, report odds ratio 0.95 confidence interval 0.70 1.24, want round two decimal places values. words, 2 significant figures numbers less 1 3 significant figures 1 larger. style_ratio() performs significant figure-like rounding manner.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style ratios — style_ratio","text":"","code":"style_ratio( x, digits = 2, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style ratios — style_ratio","text":"x (numeric) Numeric vector digits (integer) Integer specifying number significant digits display numbers 1. Numbers larger 1 digits + 1. Default digits = 2. big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") prefix (string) Additional text display number. suffix (string) Additional text display number. ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style ratios — style_ratio","text":"character vector styled ratios","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Style ratios — style_ratio","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_ratio.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style ratios — style_ratio","text":"","code":"c(0.123, 0.9, 1.1234, 12.345, 101.234, -0.123, -0.9, -1.1234, -12.345, -101.234) |> style_ratio() #> [1] \"0.12\" \"0.90\" \"1.12\" \"12.3\" \"101\" \"-0.12\" \"-0.90\" \"-1.12\" \"-12.3\" #> [10] \"-101\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":null,"dir":"Reference","previous_headings":"","what":"Style significant figure-like rounding — style_sigfig","title":"Style significant figure-like rounding — style_sigfig","text":"Converts numeric argument string rounded significant figure-like number. Scientific notation output avoided, however, additional significant figures may displayed large numbers. example, number significant digits requested 2, 123 displayed (rather 120 1.2x10^2).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Style significant figure-like rounding — style_sigfig","text":"","code":"style_sigfig( x, digits = 2, scale = 1, big.mark = ifelse(decimal.mark == \",\", \" \", \",\"), decimal.mark = getOption(\"OutDec\"), prefix = \"\", suffix = \"\", ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Style significant figure-like rounding — style_sigfig","text":"x Numeric vector digits Integer specifying minimum number significant digits display scale (scalar numeric) scaling factor: x multiplied scale formatting. big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") prefix (string) Additional text display number. suffix (string) Additional text display number. ... Arguments passed base::format()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Style significant figure-like rounding — style_sigfig","text":"character vector styled numbers","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Style significant figure-like rounding — style_sigfig","text":"Scientific notation output avoided. 2 significant figures requested, number rounded 2 decimal places. example, number rounded 2 decimals places abs(x) < 1, 1 decimal place abs(x) >= 1 & abs(x) < 10, nearest integer abs(x) >= 10. Additional significant figures may displayed large numbers. example, number significant digits requested 2, 123 displayed (rather 120 1.2x10^2).","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Style significant figure-like rounding — style_sigfig","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/style_sigfig.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Style significant figure-like rounding — style_sigfig","text":"","code":"c(0.123, 0.9, 1.1234, 12.345, -0.123, -0.9, -1.1234, -132.345, NA, -0.001) %>% style_sigfig() #> [1] \"0.12\" \"0.90\" \"1.1\" \"12\" \"-0.12\" \"-0.90\" \"-1.1\" \"-132\" NA #> [10] \"0.00\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/syntax.html","id":null,"dir":"Reference","previous_headings":"","what":"Syntax and Notation — syntax","title":"Syntax and Notation — syntax","text":"Syntax Notation","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/syntax.html","id":"selectors","dir":"Reference","previous_headings":"","what":"Selectors","title":"Syntax and Notation — syntax","text":"gtsummary package also utilizes selectors: selectors tidyselect package custom selectors. Review help files details. tidy selectors everything(), all_of(), any_of(), starts_with(), ends_with(), contains(), matches(), num_range(), last_col() gtsummary selectors all_continuous(), all_categorical(), all_dichotomous(), all_continuous2(), all_tests(), all_stat_cols(), all_interaction(), all_intercepts(), all_contrasts()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/syntax.html","id":"formula-and-list-selectors","dir":"Reference","previous_headings":"","what":"Formula and List Selectors","title":"Syntax and Notation — syntax","text":"Many arguments throughout gtsummary package accept list formula notation, e.g. tbl_summary(statistic=). enumerates tips shortcuts using list formulas. List Formulas Typical usage includes list formulas, LHS variable name selector. Named List may also pass named list; however, tidyselect gtsummary selectors supported syntax. Hybrid Named List/List Formulas Pass combination formulas named elements Shortcuts can pass single formula, equivalent passing formula list. shortcut select variables, can omit LHS formula. two calls equivalent. Combination Selectors Selectors can combined using c() function.","code":"tbl_summary(statistic = list(age ~ \"{mean}\", all_categorical() ~ \"{n}\")) tbl_summary(statistic = list(age = \"{mean}\", response = \"{n}\")) tbl_summary(statistic = list(age = \"{mean}\", all_categorical() ~ \"{n}\")) tbl_summary(statistic = all_categorical() ~ \"{n}\") tbl_summary(statistic = ~\"{n}\") tbl_summary(statistic = everything() ~ \"{n}\") tbl_summary(statistic = c(everything(), -grade) ~ \"{n}\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize continuous variable — tbl_ard_continuous","title":"Summarize continuous variable — tbl_ard_continuous","text":"Summarize continuous variable one categorical variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize continuous variable — tbl_ard_continuous","text":"","code":"tbl_ard_continuous( cards, variable, include, by = NULL, label = NULL, statistic = everything() ~ \"{median} ({p25}, {p75})\", value = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize continuous variable — tbl_ard_continuous","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. variable (string) single variable name continuous variable summarized. include (character) Character vector categorical variables (string) single variable name stratifying variable. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (formula-list-selector) Specifies summary statistics display variable. default everything() ~ \"{median} ({p25}, {p75})\". value (formula-list-selector) Supply value display variable single row, printing results variable associated value (similar 'dichotomous' display tbl_summary()).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summarize continuous variable — tbl_ard_continuous","text":"gtsummary table class \"tbl_ard_summary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize continuous variable — tbl_ard_continuous","text":"","code":"library(cards) # Example 1 ---------------------------------- # the primary ARD with the results ard_continuous( # the order variables are passed is important for the `by` variable. # 'trt' is the column stratifying variable and needs to be listed first. trial, by = c(trt, grade), variables = age ) |> # adding OPTIONAL information about the summary variables bind_ard( # add univariate trt tabulation ard_categorical(trial, variables = trt), # add missing and attributes ARD ard_missing(trial, by = c(trt, grade), variables = age), ard_attributes(trial, variables = c(trt, grade, age)) ) |> tbl_ard_continuous(by = \"trt\", variable = \"age\", include = \"grade\") Characteristic Drug A1 Drug B1 Grade     I 46.0 (36.0, 60.0) 48.0 (42.0, 55.0)    II 44.5 (31.0, 55.0) 50.5 (42.0, 57.5)    III 51.5 (41.5, 60.5) 45.0 (36.0, 52.0)1 Age: Median (Q1, Q3) # Example 2 ---------------------------------- # the primary ARD with the results ard_continuous(trial, by = grade, variables = age) |> # adding OPTIONAL information about the summary variables bind_ard( # add missing and attributes ARD ard_missing(trial, by = grade, variables = age), ard_attributes(trial, variables = c(grade, age)) ) |> tbl_ard_continuous(variable = \"age\", include = \"grade\") Characteristic Overall1 Grade     I 47.0 (37.0, 56.0)    II 48.5 (37.0, 57.0)    III 47.0 (38.0, 58.0)1 Age: Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":null,"dir":"Reference","previous_headings":"","what":"ARD Hierarchical Table — tbl_ard_hierarchical","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"preview function. changes coming releases, changes undergo formal deprecation cycle. Constructs tables nested hierarchical data structures (e.g. adverse events).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"","code":"tbl_ard_hierarchical( cards, variables, by = NULL, include = everything(), statistic = ~\"{n} ({p}%)\", label = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. variables (tidy-select) character vector tidy-selector columns data used create hierarchy. Hierarchy built variables order given. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. include (tidy-select) variables hierarchy summary statistics returned (variable label rows) Including last element hierarchy effect since level row variable. default everything(). statistic (formula-list-selector) used specify summary statistics display variables tbl_hierarchical(). default everything() ~ \"{n} ({p})\". label (formula-list-selector) used override default labels hierarchical table, e.g. list(AESOC = \"System Organ Class\"). default variable column label attribute, attr(., 'label'). label set, column name used.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"gtsummary table class \"tbl_ard_hierarchical\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_hierarchical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ARD Hierarchical Table — tbl_ard_hierarchical","text":"","code":"ADAE_subset <- cards::ADAE |> dplyr::filter( AESOC %in% unique(cards::ADAE$AESOC)[1:5], AETERM %in% unique(cards::ADAE$AETERM)[1:5] ) # Example 1: Event Rates -------------------- # First, build the ARD ard <- cards::ard_stack_hierarchical( data = ADAE_subset, variables = c(AESOC, AETERM), by = TRTA, denominator = cards::ADSL |> mutate(TRTA = ARM), id = USUBJID ) # Second, build table from the ARD tbl_ard_hierarchical( cards = ard, variables = c(AESOC, AETERM), by = TRTA ) AESOC     AETERM Placebo N = 861 Xanomeline High Dose N = 841 Xanomeline Low Dose N = 841 CARDIAC DISORDERS 2 (2.3%) 3 (3.6%) 0 (0.0%)    ATRIOVENTRICULAR BLOCK SECOND DEGREE 2 (2.3%) 3 (3.6%) 0 (0.0%)GASTROINTESTINAL DISORDERS 9 (10.5%) 4 (4.8%) 5 (6.0%)    DIARRHOEA 9 (10.5%) 4 (4.8%) 5 (6.0%)GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS 8 (9.3%) 25 (29.8%) 24 (28.6%)    APPLICATION SITE ERYTHEMA 3 (3.5%) 15 (17.9%) 12 (14.3%)    APPLICATION SITE PRURITUS 6 (7.0%) 22 (26.2%) 22 (26.2%)SKIN AND SUBCUTANEOUS TISSUE DISORDERS 9 (10.5%) 14 (16.7%) 15 (17.9%)    ERYTHEMA 9 (10.5%) 14 (16.7%) 15 (17.9%)1 n (%) # Example 2: Event Counts ------------------- ard <- cards::ard_stack_hierarchical_count( data = ADAE_subset, variables = c(AESOC, AETERM), by = TRTA, denominator = cards::ADSL |> mutate(TRTA = ARM) ) tbl_ard_hierarchical( cards = ard, variables = c(AESOC, AETERM), by = TRTA, statistic = ~\"{n}\" ) AESOC     AETERM Placebo N = 861 Xanomeline High Dose N = 841 Xanomeline Low Dose N = 841 CARDIAC DISORDERS 2 4 0    ATRIOVENTRICULAR BLOCK SECOND DEGREE 2 4 0GASTROINTESTINAL DISORDERS 10 4 7    DIARRHOEA 10 4 7GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS 13 58 53    APPLICATION SITE ERYTHEMA 3 23 20    APPLICATION SITE PRURITUS 10 35 33SKIN AND SUBCUTANEOUS TISSUE DISORDERS 13 22 24    ERYTHEMA 13 22 241 n"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"ARD summary table — tbl_ard_summary","title":"ARD summary table — tbl_ard_summary","text":"tbl_ard_summary() function tables descriptive statistics continuous, categorical, dichotomous variables. functions accepts ARD object.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"ARD summary table — tbl_ard_summary","text":"","code":"tbl_ard_summary( cards, by = NULL, statistic = list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"), type = NULL, label = NULL, missing = c(\"no\", \"ifany\", \"always\"), missing_text = \"Unknown\", missing_stat = \"{N_miss}\", include = everything(), overall = FALSE )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"ARD summary table — tbl_ard_summary","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. (tidy-select) single column data. Summary statistics stratified variable. Default NULL statistic (formula-list-selector) Used specify summary statistics variable. statistics must present card new statistics calculated function. default list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"). type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). Continuous summaries may assigned c(\"continuous\", \"continuous2\"), categorical dichotomous modified. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"\", \"ifany\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss include (tidy-select) Variables include summary table. Default everything() overall (scalar logical) TRUE, cards input parsed two parts run tbl_ard_summary(cards_by) |> add_overall(cards_overall). Can used argument specified. Default FALSE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"ARD summary table — tbl_ard_summary","text":"gtsummary table class \"tbl_ard_summary\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"ARD summary table — tbl_ard_summary","text":"three types additional data can included ARD improve default appearance table. Attributes: attributes included, default labels variable labels, available. Attributes can included ARD cards::ard_attributes() ard_stack(.attributes = TRUE). Missing: missing results included, users can include missing counts rates variables tbl_ard_summary(missing = c(\"ifany\", \"always\")). missing statistics can included ARD cards::ard_missing() ard_stack(.missing = TRUE). Total N: total N saved internally available, can calculated cards::ard_total_n() ard_stack(.total_n = TRUE).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"ARD summary table — tbl_ard_summary","text":"","code":"library(cards) ard_stack( data = ADSL, ard_categorical(variables = \"AGEGR1\"), ard_continuous(variables = \"AGE\"), .attributes = TRUE, .missing = TRUE, .total_n = TRUE ) |> tbl_ard_summary() Characteristic Overall1 Pooled Age Group 1     65-80 144 (56.7%)    <65 33 (13.0%)    >80 77 (30.3%)Age 77.0 (70.0, 81.0)1 n (%); Median (Q1, Q3) ard_stack( data = ADSL, .by = ARM, ard_categorical(variables = \"AGEGR1\"), ard_continuous(variables = \"AGE\"), .attributes = TRUE, .missing = TRUE, .total_n = TRUE ) |> tbl_ard_summary(by = ARM) Characteristic Placebo1 Xanomeline High Dose1 Xanomeline Low Dose1 Pooled Age Group 1     65-80 42 (48.8%) 55 (65.5%) 47 (56.0%)    <65 14 (16.3%) 11 (13.1%) 8 (9.5%)    >80 30 (34.9%) 18 (21.4%) 29 (34.5%)Age 76.0 (69.0, 82.0) 76.0 (70.5, 80.0) 77.5 (71.0, 82.0)1 n (%); Median (Q1, Q3) ard_stack( data = ADSL, .by = ARM, ard_categorical(variables = \"AGEGR1\"), ard_continuous(variables = \"AGE\"), .attributes = TRUE, .missing = TRUE, .total_n = TRUE, .overall = TRUE ) |> tbl_ard_summary(by = ARM, overall = TRUE) Characteristic Overall1 Placebo1 Xanomeline High Dose1 Xanomeline Low Dose1 Pooled Age Group 1     65-80 144 (56.7%) 42 (48.8%) 55 (65.5%) 47 (56.0%)    <65 33 (13.0%) 14 (16.3%) 11 (13.1%) 8 (9.5%)    >80 77 (30.3%) 30 (34.9%) 18 (21.4%) 29 (34.5%)Age 77.0 (70.0, 81.0) 76.0 (69.0, 82.0) 76.0 (70.5, 80.0) 77.5 (71.0, 82.0)1 n (%); Median (Q1, Q3)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide ARD summary table — tbl_ard_wide_summary","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"function similar tbl_ard_summary(), places summary statistics wide, separate columns. included variables must summary type, e.g. continuous summaries categorical summaries (encompasses dichotomous variables).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"","code":"tbl_ard_wide_summary( cards, statistic = switch(type[[1]], continuous = c(\"{median}\", \"{p25}, {p75}\"), c(\"{n}\", \"{p}%\")), type = NULL, label = NULL, value = NULL, include = everything() )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"cards (card) ARD object class \"card\" typically created cards::ard_*() functions. statistic (character) character vector statistics present. element vector result column summary table. Default c(\"{median}\", \"{p25}, {p75}\") continuous summaries, c(\"{n}\", \"{p}%\") categorical/dichotomous summaries type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. include (tidy-select) Variables include summary table. Default everything().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"gtsummary table class 'tbl_wide_summary'","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_ard_wide_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Wide ARD summary table — tbl_ard_wide_summary","text":"","code":"library(cards) ard_stack( trial, ard_continuous(variables = age), .missing = TRUE, .attributes = TRUE, .total_n = TRUE ) |> tbl_ard_wide_summary() Characteristic Median Q1, Q3 Age 47.0 38.0, 57.0 ard_stack( trial, ard_dichotomous(variables = response), ard_categorical(variables = grade), .missing = TRUE, .attributes = TRUE, .total_n = TRUE ) |> tbl_ard_wide_summary() Characteristic n % Tumor Response 61 31.6%Grade     I 68 34.0%    II 68 34.0%    III 64 32.0%"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":null,"dir":"Reference","previous_headings":"","what":"Butcher table — tbl_butcher","title":"Butcher table — tbl_butcher","text":"gtsummary objects can become large size becomes cumbersome working object. function removes elements gtsummary object, except required print table. may result gtsummary functions add information modify table, add_global_p(), longer execute excess elements removed (aka butchered). note, majority inline_text() calls continue execute properly.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Butcher table — tbl_butcher","text":"","code":"tbl_butcher(x, include = c(\"table_body\", \"table_styling\"))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Butcher table — tbl_butcher","text":"x (gtsummary) gtsummary object include (character) names additional elements retain gtsummary object. c(\"table_body\", \"table_styling\") always retained.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Butcher table — tbl_butcher","text":"gtsummary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_butcher.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Butcher table — tbl_butcher","text":"","code":"tbl_large <- trial |> tbl_uvregression( y = age, method = lm ) tbl_butchered <- tbl_large |> tbl_butcher() # size comparison object.size(tbl_large) |> format(units = \"Mb\") #> [1] \"7.1 Mb\" object.size(tbl_butchered)|> format(units = \"Mb\") #> [1] \"1.2 Mb\""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":null,"dir":"Reference","previous_headings":"","what":"Summarize continuous variable — tbl_continuous","title":"Summarize continuous variable — tbl_continuous","text":"Summarize continuous variable one categorical variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summarize continuous variable — tbl_continuous","text":"","code":"tbl_continuous( data, variable, include = everything(), digits = NULL, by = NULL, statistic = everything() ~ \"{median} ({p25}, {p75})\", label = NULL, value = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summarize continuous variable — tbl_continuous","text":"data (data.frame) data frame. variable (tidy-select) single column data. Variable name continuous column summarized. include (tidy-select) Variables include summary table. Default everything(). digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. statistic (formula-list-selector) Specifies summary statistics display variable. default everything() ~ \"{median} ({p25}, {p75})\". label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. value (formula-list-selector) Supply value display variable single row, printing results variable associated value (similar 'dichotomous' display tbl_summary()).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summarize continuous variable — tbl_continuous","text":"gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_continuous.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summarize continuous variable — tbl_continuous","text":"","code":"# Example 1 ---------------------------------- tbl_continuous( data = trial, variable = age, by = trt, include = grade ) Characteristic Drug A N = 981 Drug B N = 1021 Grade     I 46 (36, 60) 48 (42, 55)    II 45 (31, 55) 51 (42, 58)    III 52 (42, 61) 45 (36, 52)1 Age: Median (Q1, Q3) # Example 2 ---------------------------------- trial |> dplyr::mutate(all_subjects = 1) |> tbl_continuous( variable = age, statistic = ~\"{mean} ({sd})\", by = trt, include = c(all_subjects, stage, grade), value = all_subjects ~ 1, label = list(all_subjects = \"All Subjects\") ) Characteristic Drug A N = 981 Drug B N = 1021 All Subjects 47 (15) 47 (14)T Stage     T1 44 (15) 50 (14)    T2 50 (13) 46 (12)    T3 49 (14) 50 (15)    T4 45 (17) 44 (15)Grade     I 46 (16) 46 (15)    II 45 (15) 50 (12)    III 51 (13) 46 (15)1 Age: Mean (SD)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":null,"dir":"Reference","previous_headings":"","what":"Cross table — tbl_cross","title":"Cross table — tbl_cross","text":"function creates cross table categorical variables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Cross table — tbl_cross","text":"","code":"tbl_cross( data, row = 1L, col = 2L, label = NULL, statistic = ifelse(percent == \"none\", \"{n}\", \"{n} ({p}%)\"), digits = NULL, percent = c(\"none\", \"column\", \"row\", \"cell\"), margin = c(\"column\", \"row\"), missing = c(\"ifany\", \"always\", \"no\"), missing_text = \"Unknown\", margin_text = \"Total\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Cross table — tbl_cross","text":"data (data.frame) data frame. row (tidy-select) Column name data used rows cross table. Default first column data. col (tidy-select) Column name data used columns cross table. Default second column data. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (string) string statistic name curly brackets replaced numeric statistic (see glue::glue). default {n}. percent argument \"column\", \"row\", \"cell\", default \"{n} ({p}%)\". digits (numeric/list/function) Specifies number decimal places round summary statistics. argument passed tbl_summary(digits = ~digits). default integers shown zero decimal places, percentages formatted style_percent(). like modify either , pass vector integers indicating number decimal places round statistics. example, statistic calculated \"{n} ({p}%)\" want percent rounded 2 decimal places use digits = c(0, 2). User may also pass styling function: digits = style_sigfig percent (string) Indicates type percentage return. Must one \"none\", \"column\", \"row\", \"cell\". Default \"cell\" {N} {p} used statistic. margin (character) Indicates margins add table. Default c(\"row\", \"column\"). Use margin = NULL suppress row column margins. missing (string) Must one c(\"ifany\", \"\", \"always\"). missing_text (string) String indicating text shown missing row. Default \"Unknown\" margin_text (string) Text display margin totals. Default \"Total\"","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Cross table — tbl_cross","text":"tbl_cross object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Cross table — tbl_cross","text":"Karissa Whiting, Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_cross.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Cross table — tbl_cross","text":"","code":"# Example 1 ---------------------------------- trial |> tbl_cross(row = trt, col = response) |> bold_labels() Tumor Response Total 0 1 Unknown Chemotherapy Treatment     Drug A 67 28 3 98    Drug B 65 33 4 102Total 132 61 7 200 # Example 2 ---------------------------------- trial |> tbl_cross(row = stage, col = trt, percent = \"cell\") |> add_p() |> bold_labels() Chemotherapy Treatment Total p-value1 Drug A Drug B T Stage 0.9    T1 28 (14%) 25 (13%) 53 (27%)     T2 25 (13%) 29 (15%) 54 (27%)     T3 22 (11%) 21 (11%) 43 (22%)     T4 23 (12%) 27 (14%) 50 (25%) Total 98 (49%) 102 (51%) 200 (100%) 1 Pearson’s Chi-squared test"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"tbl_custom_summary() function calculates descriptive statistics continuous, categorical, dichotomous variables. function similar tbl_summary() allows provide custom function charge computing statistics (see Details).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"","code":"tbl_custom_summary( data, by = NULL, label = NULL, stat_fns, statistic, digits = NULL, type = NULL, value = NULL, missing = c(\"ifany\", \"no\", \"always\"), missing_text = \"Unknown\", missing_stat = \"{N_miss}\", include = everything(), overall_row = FALSE, overall_row_last = FALSE, overall_row_label = \"Overall\" )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"data (data.frame) data frame. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. stat_fns (formula-list-selector) Specifies function used compute statistics (see details examples). can also use dedicated helpers ratio_summary() proportion_summary(). statistic (formula-list-selector) Specifies summary statistics display variable. default list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"). See details. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"ifany\", \"\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss. include (tidy-select) Variables include summary table. Default everything(). overall_row (scalar logical) Logical indicator display overall row. Default FALSE. Use add_overall() add overall column. overall_row_last (scalar logical) Logical indicator display overall row last table. Default FALSE, display overall row first. overall_row_label (string) String indicating overall row label. Default \"Overall\".","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"tbl_custom_summary object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"similarities-with-tbl-summary-","dir":"Reference","previous_headings":"","what":"Similarities with tbl_summary()","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"Please refer help file tbl_summary() regarding use select helpers, arguments include, , type, value, digits, missing missing_text.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"stat-fns-argument","dir":"Reference","previous_headings":"","what":"stat_fns argument","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"stat_fns argument specify custom function(s) used computing summary statistics. example, stat_fns = everything() ~ foo. function may take following arguments: foo(data, full_data, variable, , type, ...) data= input data frame passed tbl_custom_summary(), subset according level variable , excluding NA values current variable full_data= full input data frame passed tbl_custom_summary() variable= string indicating variable perform calculation = string indicating variable tbl_custom_summary=, present type= string indicating type variable (continuous, categorical, ...) stat_display= string indicating statistic display (statistic argument, variable) user-defined need utilize inputs. encouraged user-defined function accept ... arguments passed function, even inputs utilized user's function, e.g. foo(data, ...) (see examples). user-defined function return one row dplyr::tibble() one column per summary statistics (see examples).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"statistic-argument","dir":"Reference","previous_headings":"","what":"statistic argument","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"statistic argument specifies statistics presented table. input list formulas specify statistics report. example, statistic = list(age ~ \"{mean} ({sd})\"). statistic name appears curly brackets replaced numeric statistic (see glue::glue()). statistics indicated statistic argument returned functions defined stat_fns argument. summary type \"continuous2\", pass vector statistics. element vector result separate row summary table. categorical continuous variables, statistics number missing non-missing observations proportions also available display. {N_obs} total number observations {N_miss} number missing observations {N_nonmiss} number non-missing observations {p_miss} percentage observations missing {p_nonmiss} percentage observations missing Note categorical variables, {N_obs}, {N_miss} {N_nonmiss} refer total number, number missing number non missing observations denominator, level categorical variable. recommended use modify_footnote_header() properly describe displayed statistics (see examples).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"caution","dir":"Reference","previous_headings":"","what":"Caution","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"returned table compatible gtsummary features applicable tbl_summary object, like add_overall(), modify_footnote_header() bold_labels(). However, inappropriate case. particular, add_p() take account type displayed statistics always return p-value comparison test current variable according groups, may incorrect displayed statistics refer third variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_custom_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a table of summary statistics using a custom summary function — tbl_custom_summary","text":"","code":"# Example 1 ---------------------------------- my_stats <- function(data, ...) { marker_sum <- sum(data$marker, na.rm = TRUE) mean_age <- mean(data$age, na.rm = TRUE) dplyr::tibble( marker_sum = marker_sum, mean_age = mean_age ) } my_stats(trial) #> # A tibble: 1 × 2 #> marker_sum mean_age #> #> 1 174. 47.2 trial |> tbl_custom_summary( include = c(\"stage\", \"grade\"), by = \"trt\", stat_fns = everything() ~ my_stats, statistic = everything() ~ \"A: {mean_age} - S: {marker_sum}\", digits = everything() ~ c(1, 0), overall_row = TRUE, overall_row_label = \"All stages & grades\" ) |> add_overall(last = TRUE) |> modify_footnote_header( footnote = \"A: mean age - S: sum of marker\", columns = all_stat_cols() ) |> bold_labels() Characteristic Drug A N = 981 Drug B N = 1021 Overall N = 2001 All stages & grades A: 47.0 - S: 94 A: 47.4 - S: 80 A: 47.2 - S: 174T Stage     T1 A: 44.1 - S: 19 A: 49.5 - S: 15 A: 46.8 - S: 35    T2 A: 50.2 - S: 29 A: 46.4 - S: 29 A: 48.1 - S: 59    T3 A: 48.8 - S: 21 A: 50.0 - S: 18 A: 49.4 - S: 39    T4 A: 45.3 - S: 24 A: 44.3 - S: 18 A: 44.8 - S: 42Grade     I A: 45.9 - S: 39 A: 46.4 - S: 31 A: 46.2 - S: 70    II A: 44.6 - S: 24 A: 50.3 - S: 19 A: 47.5 - S: 43    III A: 51.0 - S: 30 A: 45.7 - S: 30 A: 48.1 - S: 611 A: mean age - S: sum of marker # Example 2 ---------------------------------- # Use `data[[variable]]` to access the current variable mean_ci <- function(data, variable, ...) { test <- t.test(data[[variable]]) dplyr::tibble( mean = test$estimate, conf.low = test$conf.int[1], conf.high = test$conf.int[2] ) } trial |> tbl_custom_summary( include = c(\"marker\", \"ttdeath\"), by = \"trt\", stat_fns = ~ mean_ci, statistic = ~ \"{mean} [{conf.low}; {conf.high}]\" ) |> add_overall(last = TRUE) |> modify_footnote_header( footnote = \"mean [95% CI]\", columns = all_stat_cols() ) Characteristic Drug A N = 981 Drug B N = 1021 Overall N = 2001 Marker Level (ng/mL) 1.02 [0.83; 1.20] 0.82 [0.65; 0.99] 0.92 [0.79; 1.04]    Unknown 6 4 10Months to Death/Censor 20.2 [19.2; 21.2] 19.0 [18.0; 20.1] 19.6 [18.9; 20.4]1 mean [95% CI] # Example 3 ---------------------------------- # Use `full_data` to access the full datasets # Returned statistic can also be a character diff_to_great_mean <- function(data, full_data, ...) { mean <- mean(data$marker, na.rm = TRUE) great_mean <- mean(full_data$marker, na.rm = TRUE) diff <- mean - great_mean dplyr::tibble( mean = mean, great_mean = great_mean, diff = diff, level = ifelse(diff > 0, \"high\", \"low\") ) } trial |> tbl_custom_summary( include = c(\"grade\", \"stage\"), by = \"trt\", stat_fns = ~ diff_to_great_mean, statistic = ~ \"{mean} ({level}, diff: {diff})\", overall_row = TRUE ) |> bold_labels() Characteristic Drug A N = 981 Drug B N = 1021 Overall 1.0173 (high, diff: 0.1014) 0.8208 (low, diff: -0.0952)Grade     I 1 (high, diff: 0) 1 (high, diff: 0)    II 1 (low, diff: 0) 1 (low, diff: 0)    III 1 (high, diff: 0) 1 (high, diff: 0)T Stage     T1 1 (low, diff: 0) 1 (low, diff: 0)    T2 1 (high, diff: 0) 1 (high, diff: 0)    T3 1 (high, diff: 0) 1 (high, diff: 0)    T4 1 (high, diff: 0) 1 (low, diff: 0)1 Mean (level, diff: diff)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":null,"dir":"Reference","previous_headings":"","what":"Hierarchical Table — tbl_hierarchical","title":"Hierarchical Table — tbl_hierarchical","text":"preview function. changes coming releases, changes undergo formal deprecation cycle. Use functions generate hierarchical tables. tbl_hierarchical(): Calculates rates events (e.g. adverse events) utilizing denominator id arguments identify rows data include rate calculation. variables contains one variable last variable variables ordered factor, rates events highest level calculated. tbl_hierarchical_count(): Calculates counts events utilizing rows tabulation.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Hierarchical Table — tbl_hierarchical","text":"","code":"tbl_hierarchical( data, variables, id, denominator, by = NULL, include = everything(), statistic = everything() ~ \"{n} ({p}%)\", overall_row = FALSE, label = NULL, digits = NULL ) tbl_hierarchical_count( data, variables, denominator = NULL, by = NULL, include = everything(), overall_row = FALSE, statistic = everything() ~ \"{n}\", label = NULL, digits = NULL )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Hierarchical Table — tbl_hierarchical","text":"data (data.frame) data frame. variables (tidy-select) character vector tidy-selector columns data used create hierarchy. Hierarchy built variables order given. id (tidy-select) argument used subset data identify rows data calculate event rates tbl_hierarchical(). denominator (data.frame, integer) used define denominator enhance output. argument required tbl_hierarchical() optional tbl_hierarchical_count(). denominator argument must specified id used calculate event rates. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. include (tidy-select) variables hierarchy summary statistics returned (variable label rows) Including last element hierarchy effect since level row variable. default everything(). statistic (formula-list-selector) used specify summary statistics display variables tbl_hierarchical(). default everything() ~ \"{n} ({p})\". overall_row (scalar logical) whether overall summary row included top table. default FALSE. label (formula-list-selector) used override default labels hierarchical table, e.g. list(AESOC = \"System Organ Class\"). default variable column label attribute, attr(., 'label'). label set, column name used. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via label_style_number() statistics n N, label_style_percent(digits=1) statistic p.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Hierarchical Table — tbl_hierarchical","text":"gtsummary table class \"tbl_hierarchical\" (tbl_hierarchical()) \"tbl_hierarchical_count\" (tbl_hierarchical_count()).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"overall-row","dir":"Reference","previous_headings":"","what":"Overall Row","title":"Hierarchical Table — tbl_hierarchical","text":"overall row can added table first row specifying overall_row = TRUE. Assuming row data corresponds one event record, row count overall number events recorded used tbl_hierarchical_count(), overall number patients recorded event used tbl_hierarchical(). label overall row can specified passing '..ard_hierarchical_overall..' element label. Similarly, rounding statistics overall row can modified using digits argument, referencing '..ard_hierarchical_overall..' name.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_hierarchical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Hierarchical Table — tbl_hierarchical","text":"","code":"ADAE_subset <- cards::ADAE |> dplyr::filter( AESOC %in% unique(cards::ADAE$AESOC)[1:5], AETERM %in% unique(cards::ADAE$AETERM)[1:5] ) # Example 1 - Event Rates -------------------- tbl_hierarchical( data = ADAE_subset, variables = c(AESOC, AETERM), by = TRTA, denominator = cards::ADSL |> mutate(TRTA = ARM), id = USUBJID, digits = everything() ~ list(p = 1), overall_row = TRUE, label = list(..ard_hierarchical_overall.. = \"Any Adverse Event\") ) Primary System Organ Class     Reported Term for the Adverse Event Placebo N = 861 Xanomeline High Dose N = 841 Xanomeline Low Dose N = 841 Any Adverse Event 26 (30.2%) 42 (50.0%) 40 (47.6%)CARDIAC DISORDERS 2 (2.3%) 3 (3.6%) 0 (0.0%)    ATRIOVENTRICULAR BLOCK SECOND DEGREE 2 (2.3%) 3 (3.6%) 0 (0.0%)GASTROINTESTINAL DISORDERS 9 (10.5%) 4 (4.8%) 5 (6.0%)    DIARRHOEA 9 (10.5%) 4 (4.8%) 5 (6.0%)GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS 8 (9.3%) 25 (29.8%) 24 (28.6%)    APPLICATION SITE ERYTHEMA 3 (3.5%) 15 (17.9%) 12 (14.3%)    APPLICATION SITE PRURITUS 6 (7.0%) 22 (26.2%) 22 (26.2%)SKIN AND SUBCUTANEOUS TISSUE DISORDERS 9 (10.5%) 14 (16.7%) 15 (17.9%)    ERYTHEMA 9 (10.5%) 14 (16.7%) 15 (17.9%)1 n (%) # Example 2 - Rates by Highest Severity ------ tbl_hierarchical( data = ADAE_subset |> mutate(AESEV = factor(AESEV, ordered = TRUE)), variables = c(AESOC, AESEV), by = TRTA, id = USUBJID, denominator = cards::ADSL |> mutate(TRTA = ARM), include = AESEV, label = list(AESEV = \"Highest Severity\") ) #> ℹ Denominator set by \"TRTA\" column in `denominator` data frame. Primary System Organ Class     Highest Severity Placebo N = 861 Xanomeline High Dose N = 841 Xanomeline Low Dose N = 841 CARDIAC DISORDERS     MILD 1 (1.2%) 1 (1.2%) 0 (0%)    MODERATE 0 (0%) 2 (2.4%) 0 (0%)    SEVERE 1 (1.2%) 0 (0%) 0 (0%)GASTROINTESTINAL DISORDERS     MILD 9 (10%) 2 (2.4%) 5 (6.0%)    MODERATE 0 (0%) 2 (2.4%) 0 (0%)    SEVERE 0 (0%) 0 (0%) 0 (0%)GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS     MILD 7 (8.1%) 12 (14%) 12 (14%)    MODERATE 1 (1.2%) 13 (15%) 10 (12%)    SEVERE 0 (0%) 0 (0%) 2 (2.4%)SKIN AND SUBCUTANEOUS TISSUE DISORDERS     MILD 5 (5.8%) 10 (12%) 7 (8.3%)    MODERATE 4 (4.7%) 4 (4.8%) 8 (9.5%)    SEVERE 0 (0%) 0 (0%) 0 (0%)1 n (%) # Example 3 - Event Counts ------------------- tbl_hierarchical_count( data = ADAE_subset, variables = c(AESOC, AETERM, AESEV), by = TRTA, overall_row = TRUE, label = list(..ard_hierarchical_overall.. = \"Total Number of AEs\") ) Primary System Organ Class     Reported Term for the Adverse Event         Severity/Intensity Placebo1 Xanomeline High Dose1 Xanomeline Low Dose1 Total Number of AEs 38 88 84CARDIAC DISORDERS 2 4 0    ATRIOVENTRICULAR BLOCK SECOND DEGREE 2 4 0        MILD 1 2 0        MODERATE 0 2 0        SEVERE 1 0 0GASTROINTESTINAL DISORDERS 10 4 7    DIARRHOEA 10 4 7        MILD 10 2 7        MODERATE 0 2 0GENERAL DISORDERS AND ADMINISTRATION SITE CONDITIONS 13 58 53    APPLICATION SITE ERYTHEMA 3 23 20        MILD 3 16 9        MODERATE 0 7 8        SEVERE 0 0 3    APPLICATION SITE PRURITUS 10 35 33        MILD 8 21 21        MODERATE 2 14 11        SEVERE 0 0 1SKIN AND SUBCUTANEOUS TISSUE DISORDERS 13 22 24    ERYTHEMA 13 22 24        MILD 8 16 12        MODERATE 5 6 121 n"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":null,"dir":"Reference","previous_headings":"","what":"Likert Summary — tbl_likert","title":"Likert Summary — tbl_likert","text":"Create table ordered categorical variables wide format.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Likert Summary — tbl_likert","text":"","code":"tbl_likert( data, statistic = ~\"{n} ({p}%)\", label = NULL, digits = NULL, include = everything(), sort = c(\"ascending\", \"descending\") )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Likert Summary — tbl_likert","text":"data (data.frame) data frame. statistic (formula-list-selector) Used specify summary statistics variable. default everything() ~ \"{n} ({p}%)\". label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). include (tidy-select) Variables include summary table. Default everything(). sort (string) indicates whether levels variables placed ascending order (default) descending.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Likert Summary — tbl_likert","text":"'tbl_likert' gtsummary table","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_likert.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Likert Summary — tbl_likert","text":"","code":"levels <- c(\"Strongly Disagree\", \"Disagree\", \"Agree\", \"Strongly Agree\") df_likert <- data.frame( recommend_friend = sample(levels, size = 20, replace = TRUE) |> factor(levels = levels), regret_purchase = sample(levels, size = 20, replace = TRUE) |> factor(levels = levels) ) # Example 1 ---------------------------------- tbl_likert_ex1 <- df_likert |> tbl_likert(include = c(recommend_friend, regret_purchase)) |> add_n() tbl_likert_ex1 Characteristic N Strongly Disagree Disagree Agree Strongly Agree recommend_friend 20 3 (15%) 5 (25%) 4 (20%) 8 (40%)regret_purchase 20 3 (15%) 6 (30%) 6 (30%) 5 (25%) # Example 2 ---------------------------------- # Add continuous summary of the likert scores list( tbl_likert_ex1, tbl_wide_summary( df_likert |> dplyr::mutate(dplyr::across(everything(), as.numeric)), statistic = c(\"{mean}\", \"{sd}\"), type = ~\"continuous\", include = c(recommend_friend, regret_purchase) ) ) |> tbl_merge(tab_spanner = FALSE) Characteristic N Strongly Disagree Disagree Agree Strongly Agree Mean SD recommend_friend 20 3 (15%) 5 (25%) 4 (20%) 8 (40%) 2.85 1.14regret_purchase 20 3 (15%) 6 (30%) 6 (30%) 5 (25%) 2.65 1.04"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":null,"dir":"Reference","previous_headings":"","what":"Merge tables — tbl_merge","title":"Merge tables — tbl_merge","text":"Merge gtsummary tables, e.g. tbl_regression, tbl_uvregression, tbl_stack, tbl_summary, tbl_svysummary, etc.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Merge tables — tbl_merge","text":"","code":"tbl_merge(tbls, tab_spanner = NULL)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Merge tables — tbl_merge","text":"tbls (list) List gtsummary objects merge tab_spanner (character) Character vector specifying spanning headers. Must length tbls. strings interpreted gt::md. Must length tbls argument. Default NULL, places default spanning header. FALSE, header placed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Merge tables — tbl_merge","text":"'tbl_merge' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Merge tables — tbl_merge","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_merge.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Merge tables — tbl_merge","text":"","code":"# Example 1 ---------------------------------- # Side-by-side Regression Models library(survival) t1 <- glm(response ~ trt + grade + age, trial, family = binomial) %>% tbl_regression(exponentiate = TRUE) t2 <- coxph(Surv(ttdeath, death) ~ trt + grade + age, trial) %>% tbl_regression(exponentiate = TRUE) tbl_merge( tbls = list(t1, t2), tab_spanner = c(\"**Tumor Response**\", \"**Time to Death**\") ) Characteristic Tumor Response Time to Death OR 95% CI p-value HR 95% CI p-value Chemotherapy Treatment     Drug A — — — —     Drug B 1.13 0.60, 2.13 0.7 1.30 0.88, 1.92 0.2Grade     I — — — —     II 0.85 0.39, 1.85 0.7 1.21 0.73, 1.99 0.5    III 1.01 0.47, 2.15 >0.9 1.79 1.12, 2.86 0.014Age 1.02 1.00, 1.04 0.10 1.01 0.99, 1.02 0.3Abbreviations: CI = Confidence Interval, HR = Hazard Ratio, OR = Odds Ratio # Example 2 ---------------------------------- # Descriptive statistics alongside univariate regression, with no spanning header t3 <- trial[c(\"age\", \"grade\", \"response\")] %>% tbl_summary(missing = \"no\") %>% add_n() %>% modify_header(stat_0 ~ \"**Summary Statistics**\") t4 <- tbl_uvregression( trial[c(\"ttdeath\", \"death\", \"age\", \"grade\", \"response\")], method = coxph, y = Surv(ttdeath, death), exponentiate = TRUE, hide_n = TRUE ) tbl_merge(tbls = list(t3, t4)) %>% modify_spanning_header(everything() ~ NA_character_) Characteristic N Summary Statistics1 HR 95% CI p-value Age 189 47 (38, 57) 1.01 0.99, 1.02 0.3Grade 200     I 68 (34%) — —     II 68 (34%) 1.28 0.80, 2.05 0.3    III 64 (32%) 1.69 1.07, 2.66 0.024Tumor Response 193 61 (32%) 0.50 0.31, 0.78 0.003Abbreviations: CI = Confidence Interval, HR = Hazard Ratio 1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":null,"dir":"Reference","previous_headings":"","what":"Regression model summary — tbl_regression","title":"Regression model summary — tbl_regression","text":"function takes regression model object returns formatted table publication-ready. function customizable allowing user create bespoke regression model summary tables. Review tbl_regression() vignette detailed examples.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Regression model summary — tbl_regression","text":"","code":"tbl_regression(x, ...) # Default S3 method tbl_regression( x, label = NULL, exponentiate = FALSE, include = everything(), show_single_row = NULL, conf.level = 0.95, intercept = FALSE, estimate_fun = ifelse(exponentiate, label_style_ratio(), label_style_sigfig()), pvalue_fun = label_style_pvalue(digits = 1), tidy_fun = broom.helpers::tidy_with_broom_or_parameters, add_estimate_to_reference_rows = FALSE, conf.int = TRUE, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Regression model summary — tbl_regression","text":"x (regression model) Regression model object ... Additional arguments passed broom.helpers::tidy_plus_plus(). label (formula-list-selector) Used change variables labels, e.g. list(age = \"Age\", stage = \"Path T Stage\") exponentiate (scalar logical) Logical indicating whether exponentiate coefficient estimates. Default FALSE. include (tidy-select) Variables include output. Default everything(). show_single_row (tidy-select) default categorical variables printed multiple rows. variable dichotomous (e.g. Yes/) wish print regression coefficient single row, include variable name(s) . conf.level (scalar real) Confidence level confidence interval/credible interval. Defaults 0.95. intercept (scalar logical) Indicates whether include intercept output. Default FALSE estimate_fun (function) Function round format coefficient estimates. Default label_style_sigfig() coefficients transformed, label_style_ratio() coefficients exponentiated. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). tidy_fun (function) Tidier function model. Default use broom::tidy(). error occurs, tidying model attempted parameters::model_parameters(), installed. add_estimate_to_reference_rows (scalar logical) Add reference value. Default FALSE. conf.int (scalar logical) Logical indicating whether include confidence interval output. Default TRUE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Regression model summary — tbl_regression","text":"tbl_regression object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Regression model summary — tbl_regression","text":"default method tbl_regression() model summary uses broom::tidy(x) perform initial tidying model object. , however, models use modifications. \"parsnip/workflows\": model prepared using parsnip/workflows, original model fit extracted original x= argument replaced model fit. typically go unnoticed; however,provided custom tidier tidy_fun= tidier applied model fit object parsnip/workflows object. \"survreg\": scale parameter removed, broom::tidy(x) %>% dplyr::filter(term != \"Log(scale)\") \"multinom\": multinomial outcome complex, one line per covariate per outcome (less reference group) \"gam\": Uses internal tidier tidy_gam() print parametric smooth terms. \"lmerMod\", \"glmerMod\", \"glmmTMB\", \"glmmadmb\", \"stanreg\", \"brmsfit\": mixed effects models use broom.mixed::tidy(x, effects = \"fixed\"). Specify tidy_fun = broom.mixed::tidy print random components.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Regression model summary — tbl_regression","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Regression model summary — tbl_regression","text":"","code":"# Example 1 ---------------------------------- glm(response ~ age + grade, trial, family = binomial()) |> tbl_regression(exponentiate = TRUE) Characteristic OR 95% CI p-value Age 1.02 1.00, 1.04 0.10Grade     I — —     II 0.85 0.39, 1.85 0.7    III 1.01 0.47, 2.16 >0.9Abbreviations: CI = Confidence Interval, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression_methods.html","id":null,"dir":"Reference","previous_headings":"","what":"Methods for tbl_regression — tbl_regression_methods","title":"Methods for tbl_regression — tbl_regression_methods","text":"regression models handled tbl_regression(), uses broom::tidy() perform initial tidying results. , however, model types modified default printing behavior. methods listed .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression_methods.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Methods for tbl_regression — tbl_regression_methods","text":"","code":"# S3 method for class 'model_fit' tbl_regression(x, ...) # S3 method for class 'workflow' tbl_regression(x, ...) # S3 method for class 'survreg' tbl_regression( x, tidy_fun = function(x, ...) dplyr::filter(broom::tidy(x, ...), .data$term != \"Log(scale)\"), ... ) # S3 method for class 'mira' tbl_regression(x, tidy_fun = pool_and_tidy_mice, ...) # S3 method for class 'mipo' tbl_regression(x, ...) # S3 method for class 'lmerMod' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'glmerMod' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'glmmTMB' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'glmmadmb' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'stanreg' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'brmsfit' tbl_regression( x, tidy_fun = function(x, ...) broom.mixed::tidy(x, ..., effects = \"fixed\"), ... ) # S3 method for class 'gam' tbl_regression(x, tidy_fun = tidy_gam, ...) # S3 method for class 'crr' tbl_regression(x, ...) # S3 method for class 'multinom' tbl_regression(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression_methods.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Methods for tbl_regression — tbl_regression_methods","text":"x (regression model) Regression model object ... arguments passed tbl_regression() tidy_fun (function) Tidier function model. Default use broom::tidy(). error occurs, tidying model attempted parameters::model_parameters(), installed.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_regression_methods.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Methods for tbl_regression — tbl_regression_methods","text":"default method tbl_regression() model summary uses broom::tidy(x) perform initial tidying model object. , however, models use modifications. \"parsnip/workflows\": model prepared using parsnip/workflows, original model fit extracted original x= argument replaced model fit. typically go unnoticed; however,provided custom tidier tidy_fun= tidier applied model fit object parsnip/workflows object. \"survreg\": scale parameter removed, broom::tidy(x) %>% dplyr::filter(term != \"Log(scale)\") \"multinom\": multinomial outcome complex, one line per covariate per outcome (less reference group) \"gam\": Uses internal tidier tidy_gam() print parametric smooth terms. \"lmerMod\", \"glmerMod\", \"glmmTMB\", \"glmmadmb\", \"stanreg\", \"brmsfit\": mixed effects models use broom.mixed::tidy(x, effects = \"fixed\"). Specify tidy_fun = broom.mixed::tidy print random components.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":null,"dir":"Reference","previous_headings":"","what":"Split gtsummary table — tbl_split","title":"Split gtsummary table — tbl_split","text":"tbl_split function splits single gtsummary table multiple tables. Updates print method expected.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Split gtsummary table — tbl_split","text":"","code":"tbl_split(x, ...) # S3 method for class 'gtsummary' tbl_split(x, variables, ...) # S3 method for class 'tbl_split' print(x, ...)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Split gtsummary table — tbl_split","text":"x (gtsummary) gtsummary table ... dots future extensions must empty. variables (tidy-select) variables split gtsummary table rows (tables separated variables)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Split gtsummary table — tbl_split","text":"tbl_split object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_split.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Split gtsummary table — tbl_split","text":"","code":"tbl <- tbl_summary(trial) |> tbl_split(variables = c(marker, grade))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":null,"dir":"Reference","previous_headings":"","what":"Stack tables — tbl_stack","title":"Stack tables — tbl_stack","text":"Assists patching together complex tables. tbl_stack() appends two gtsummary tables. Column attributes, including number formatting column footnotes, retained first passed gtsummary object.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Stack tables — tbl_stack","text":"","code":"tbl_stack(tbls, group_header = NULL, quiet = FALSE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Stack tables — tbl_stack","text":"tbls (list) List gtsummary objects group_header (character) Character vector table headers length matches length tbls quiet (scalar logical) Logical indicating whether suppress additional messaging. Default FALSE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Stack tables — tbl_stack","text":"tbl_stack object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Stack tables — tbl_stack","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_stack.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Stack tables — tbl_stack","text":"","code":"# Example 1 ---------------------------------- # stacking two tbl_regression objects t1 <- glm(response ~ trt, trial, family = binomial) %>% tbl_regression( exponentiate = TRUE, label = list(trt ~ \"Treatment (unadjusted)\") ) t2 <- glm(response ~ trt + grade + stage + marker, trial, family = binomial) %>% tbl_regression( include = \"trt\", exponentiate = TRUE, label = list(trt ~ \"Treatment (adjusted)\") ) tbl_stack(list(t1, t2)) Characteristic OR 95% CI p-value Treatment (unadjusted)     Drug A — —     Drug B 1.21 0.66, 2.24 0.5Treatment (adjusted)     Drug A — —     Drug B 1.48 0.78, 2.86 0.2Abbreviations: CI = Confidence Interval, OR = Odds Ratio # Example 2 ---------------------------------- # stacking two tbl_merge objects library(survival) t3 <- coxph(Surv(ttdeath, death) ~ trt, trial) %>% tbl_regression( exponentiate = TRUE, label = list(trt ~ \"Treatment (unadjusted)\") ) t4 <- coxph(Surv(ttdeath, death) ~ trt + grade + stage + marker, trial) %>% tbl_regression( include = \"trt\", exponentiate = TRUE, label = list(trt ~ \"Treatment (adjusted)\") ) # first merging, then stacking row1 <- tbl_merge(list(t1, t3), tab_spanner = c(\"Tumor Response\", \"Death\")) row2 <- tbl_merge(list(t2, t4)) tbl_stack(list(row1, row2), group_header = c(\"Unadjusted Analysis\", \"Adjusted Analysis\")) #> Column headers among stacked tables differ. Headers from the first table are #> used. #> ℹ Use `quiet = TRUE` to suppress this message. Characteristic Tumor Response Death OR 95% CI p-value HR 95% CI p-value Unadjusted Analysis Treatment (unadjusted)     Drug A — — — —     Drug B 1.21 0.66, 2.24 0.5 1.25 0.86, 1.81 0.2Adjusted Analysis Treatment (adjusted)     Drug A — — — —     Drug B 1.48 0.78, 2.86 0.2 1.30 0.88, 1.92 0.2Abbreviations: CI = Confidence Interval, HR = Hazard Ratio, OR = Odds Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":null,"dir":"Reference","previous_headings":"","what":"Stratified gtsummary tables — tbl_strata","title":"Stratified gtsummary tables — tbl_strata","text":"Build stratified gtsummary table. gtsummary table accepts data frame first argument can stratified. tbl_strata(), stratified subset data frame passed function .tbl_fun=, e.g. purrr::map(data, .tbl_fun). tbl_strata2(), stratified data frame strata level passed .tbl_fun=, e.g. purrr::map2(data, strata, .tbl_fun)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Stratified gtsummary tables — tbl_strata","text":"","code":"tbl_strata( data, strata, .tbl_fun, ..., .sep = \", \", .combine_with = c(\"tbl_merge\", \"tbl_stack\"), .combine_args = NULL, .header = ifelse(.combine_with == \"tbl_merge\", \"**{strata}**\", \"{strata}\"), .stack_group_header = NULL, .quiet = NULL ) tbl_strata2( data, strata, .tbl_fun, ..., .sep = \", \", .combine_with = c(\"tbl_merge\", \"tbl_stack\"), .combine_args = NULL, .header = ifelse(.combine_with == \"tbl_merge\", \"**{strata}**\", \"{strata}\"), .stack_group_header = NULL, .quiet = TRUE )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Stratified gtsummary tables — tbl_strata","text":"data (data.frame, survey.design) data frame survey object strata (tidy-select) character vector tidy-selector columns data stratify results .tbl_fun (function) function formula. function, used . formula, e.g. ~ .x %>% tbl_summary() %>% add_p(), converted function. stratified data frame passed function. ... Additional arguments passed .tbl_fun function. .sep (string) one stratifying variable passed, string used separate levels spanning header. Default \", \" .combine_with (string) One c(\"tbl_merge\", \"tbl_stack\"). Names function used combine stratified tables. .combine_args (named list) named list arguments passed function specified .combine_with .header (string) String indicating headers placed. Default \"**{strata}**\" .combine_with = \"tbl_merge\" \"{strata}\" .combine_with = \"tbl_stack\". Items placed curly brackets evaluated according glue::glue() syntax. - strata stratum levels - n N within stratum - N Overall N evaluated value .header also available within tbl_strata2(.tbl_fun) .stack_group_header .quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"tips","dir":"Reference","previous_headings":"","what":"Tips","title":"Stratified gtsummary tables — tbl_strata","text":"tbl_summary() number digits continuous variables rounded determined separately within stratum data frame. Set digits= argument ensure continuous variables rounded number decimal places. levels categorical variable unobserved within stratum, convert variable factor ensure levels appear stratum's summary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Stratified gtsummary tables — tbl_strata","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_strata.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Stratified gtsummary tables — tbl_strata","text":"Response Rate Grade","code":"# Example 1 ---------------------------------- trial |> select(age, grade, stage, trt) |> mutate(grade = paste(\"Grade\", grade)) |> tbl_strata( strata = grade, .tbl_fun = ~ .x |> tbl_summary(by = trt, missing = \"no\") |> add_n(), .header = \"**{strata}**, N = {n}\" ) Characteristic Grade I, N = 68 Grade II, N = 68 Grade III, N = 64 N Drug A N = 351 Drug B N = 331 N Drug A N = 321 Drug B N = 361 N Drug A N = 311 Drug B N = 331 Age 66 46 (36, 60) 48 (42, 55) 62 45 (31, 55) 51 (42, 58) 61 52 (42, 61) 45 (36, 52)T Stage 68 68 64     T1 8 (23%) 9 (27%) 14 (44%) 9 (25%) 6 (19%) 7 (21%)    T2 8 (23%) 10 (30%) 8 (25%) 9 (25%) 9 (29%) 10 (30%)    T3 11 (31%) 7 (21%) 5 (16%) 6 (17%) 6 (19%) 8 (24%)    T4 8 (23%) 7 (21%) 5 (16%) 12 (33%) 10 (32%) 8 (24%)1 Median (Q1, Q3); n (%) # Example 2 ---------------------------------- trial |> select(grade, response) |> mutate(grade = paste(\"Grade\", grade)) |> tbl_strata2( strata = grade, .tbl_fun = ~ .x %>% tbl_summary( label = list(response = .y), missing = \"no\", statistic = response ~ \"{p}%\" ) |> add_ci(pattern = \"{stat} ({ci})\") |> modify_header(stat_0 = \"**Rate (95% CI)**\") |> remove_footnote_header(stat_0), .combine_with = \"tbl_stack\", .combine_args = list(group_header = NULL) ) |> modify_caption(\"**Response Rate by Grade**\") Response Rate by Grade Characteristic Rate (95% CI) Grade I 31% (21%, 44%)Grade II 30% (20%, 43%)Grade III 33% (22%, 46%)Abbreviation: CI = Confidence Interval"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary table — tbl_summary","title":"Summary table — tbl_summary","text":"tbl_summary() function calculates descriptive statistics continuous, categorical, dichotomous variables. Review tbl_summary vignette detailed examples.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary table — tbl_summary","text":"","code":"tbl_summary( data, by = NULL, label = NULL, statistic = list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"), digits = NULL, type = NULL, value = NULL, missing = c(\"ifany\", \"no\", \"always\"), missing_text = \"Unknown\", missing_stat = \"{N_miss}\", sort = all_categorical(FALSE) ~ \"alphanumeric\", percent = c(\"column\", \"row\", \"cell\"), include = everything() )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary table — tbl_summary","text":"data (data.frame) data frame. (tidy-select) single column data. Summary statistics stratified variable. Default NULL. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (formula-list-selector) Specifies summary statistics display variable. default list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"). See details. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"ifany\", \"\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss. sort (formula-list-selector) Specifies sorting perform categorical variables. Values must one c(\"alphanumeric\", \"frequency\"). Default all_categorical(FALSE) ~ \"alphanumeric\". percent (string) Indicates type percentage return. Must one c(\"column\", \"row\", \"cell\"). Default \"column\". include (tidy-select) Variables include summary table. Default everything().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary table — tbl_summary","text":"gtsummary table class \"tbl_summary\" table class c('tbl_summary', 'gtsummary')","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"statistic-argument","dir":"Reference","previous_headings":"","what":"statistic argument","title":"Summary table — tbl_summary","text":"statistic argument specifies statistics presented table. input dictates summary statistics presented table. example, statistic = list(age ~ \"{mean} ({sd})\") report mean standard deviation age; statistic = list(all_continuous() ~ \"{mean} ({sd})\") report mean standard deviation continuous variables. values interpreted using glue::glue() syntax: name appears curly brackets interpreted function name formatted result function placed table. categorical variables, following statistics available display: {n} (frequency), {N} (denominator), {p} (percent). continuous variables, univariate function may used. commonly used functions {median}, {mean}, {sd}, {min}, {max}. Additionally, {p##} available percentiles, ## integer 0 100. example, p25: quantile(probs=0.25, type=2). summary type \"continuous2\", pass vector statistics. element vector result separate row summary table. categorical continuous variables, statistics number missing non-missing observations proportions available display. {N_obs} total number observations {N_miss} number missing observations {N_nonmiss} number non-missing observations {p_miss} percentage observations missing {p_nonmiss} percentage observations missing","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"digits-argument","dir":"Reference","previous_headings":"","what":"digits argument","title":"Summary table — tbl_summary","text":"digits argument specifies number digits (formatting function) statistics rounded . values passed can either single integer, vector integers, function, list functions. single integer function passed, recycled length number statistics presented. example, statistic \"{mean} ({sd})\", equivalent pass 1, c(1, 1), label_style_number(digits=1), list(label_style_number(digits=1), label_style_number(digits=1)). Named lists also accepted change default formatting single statistic, e.g. list(sd = label_style_number(digits=1)).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"type-and-value-arguments","dir":"Reference","previous_headings":"","what":"type and value arguments","title":"Summary table — tbl_summary","text":"four summary types. Use type argument change default summary types. \"continuous\" summaries shown single row. numeric variables default summary type continuous. \"continuous2\" summaries shown 2 rows \"categorical\" multi-line summaries nominal data. Character variables, factor variables, numeric variables fewer 10 unique levels default type categorical. change numeric variable continuous defaulted categorical, use type = list(varname ~ \"continuous\") \"dichotomous\" categorical variables displayed single row, rather one row per level variable. Variables coded TRUE/FALSE, 0/1, yes/assumed dichotomous, TRUE, 1, yes rows displayed. Otherwise, value display must specified value argument, e.g. value = list(varname ~ \"level show\")","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summary table — tbl_summary","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary table — tbl_summary","text":"","code":"# Example 1 ---------------------------------- trial |> select(age, grade, response) |> tbl_summary() Characteristic N = 2001 Age 47 (38, 57)    Unknown 11Grade     I 68 (34%)    II 68 (34%)    III 64 (32%)Tumor Response 61 (32%)    Unknown 71 Median (Q1, Q3); n (%) # Example 2 ---------------------------------- trial |> select(age, grade, response, trt) |> tbl_summary( by = trt, label = list(age = \"Patient Age\"), statistic = list(all_continuous() ~ \"{mean} ({sd})\"), digits = list(age = c(0, 1)) ) Characteristic Drug A N = 981 Drug B N = 1021 Patient Age 47 (14.7) 47 (14.0)    Unknown 7 4Grade     I 35 (36%) 33 (32%)    II 32 (33%) 36 (35%)    III 31 (32%) 33 (32%)Tumor Response 28 (29%) 33 (34%)    Unknown 3 41 Mean (SD); n (%) # Example 3 ---------------------------------- trial |> select(age, marker) |> tbl_summary( type = all_continuous() ~ \"continuous2\", statistic = all_continuous() ~ c(\"{median} ({p25}, {p75})\", \"{min}, {max}\"), missing = \"no\" ) Characteristic N = 200 Age     Median (Q1, Q3) 47 (38, 57)    Min, Max 6, 83Marker Level (ng/mL)     Median (Q1, Q3) 0.64 (0.22, 1.41)    Min, Max 0.00, 3.87"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Survival table — tbl_survfit","title":"Survival table — tbl_survfit","text":"Function takes survfit object argument, provides formatted summary table results","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Survival table — tbl_survfit","text":"","code":"tbl_survfit(x, ...) # S3 method for class 'survfit' tbl_survfit(x, ...) # S3 method for class 'data.frame' tbl_survfit(x, y, include = everything(), conf.level = 0.95, ...) # S3 method for class 'list' tbl_survfit( x, times = NULL, probs = NULL, statistic = \"{estimate} ({conf.low}, {conf.high})\", label = NULL, label_header = ifelse(!is.null(times), \"**Time {time}**\", \"**{style_sigfig(prob, scale=100)}% Percentile**\"), estimate_fun = ifelse(!is.null(times), label_style_percent(suffix = \"%\"), label_style_sigfig()), missing = \"--\", type = NULL, reverse = FALSE, quiet = TRUE, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Survival table — tbl_survfit","text":"x (survfit, list, data.frame) survfit object, list survfit objects, data frame. data frame passed, list survfit objects constructed using variable stratifying variable. ... tbl_survfit.data.frame() tbl_survfit.survfit() arguments passed tbl_survfit.list(). used tbl_survfit.list() called directly. y outcome call, e.g. y = Surv(ttdeath, death) include Variable include stratifying variables. conf.level (scalar numeric) ] Confidence level confidence intervals. Default 0.95 times (numeric) vector times return survival probabilities. probs (numeric) vector probabilities values (0,1) specifying survival quantiles return. statistic (string) string defining statistics present table. Default \"{estimate} ({conf.low}, {conf.high})\" label (formula-list-selector) List formulas specifying variables labels, e.g. list(age = \"Age, yrs\", stage = \"Path T Stage\"), string single variable table. label_header (string) string specifying column labels statistics. Default \"{prob} Percentile\" survival percentiles, \"Time {time}\" n-year survival estimates estimate_fun (function) function format Kaplan-Meier estimates. Default label_style_percent() survival probabilities label_style_sigfig() survival times missing (string) text fill estimate estimable. Default \"--\" type (string NULL) type statistic report. Available Kaplan-Meier time estimates , otherwise type ignored. Default NULL. Must one following: reverse quiet","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Survival table — tbl_survfit","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Survival table — tbl_survfit","text":"","code":"library(survival) # Example 1 ---------------------------------- # Pass single survfit() object tbl_survfit( survfit(Surv(ttdeath, death) ~ trt, trial), times = c(12, 24), label_header = \"**{time} Month**\" ) Characteristic 12 Month 24 Month Chemotherapy Treatment     Drug A 91% (85%, 97%) 47% (38%, 58%)    Drug B 86% (80%, 93%) 41% (33%, 52%) # Example 2 ---------------------------------- # Pass a data frame tbl_survfit( trial, y = \"Surv(ttdeath, death)\", include = c(trt, grade), probs = 0.5, label_header = \"**Median Survival**\" ) Characteristic Median Survival Chemotherapy Treatment     Drug A 24 (21, —)    Drug B 21 (18, —)Grade     I — (22, —)    II 22 (18, —)    III 20 (18, 23) # Example 3 ---------------------------------- # Pass a list of survfit() objects list(survfit(Surv(ttdeath, death) ~ 1, trial), survfit(Surv(ttdeath, death) ~ trt, trial)) |> tbl_survfit(times = c(12, 24)) Characteristic Time 12 Time 24 Overall 89% (84%, 93%) 44% (38%, 51%)Chemotherapy Treatment     Drug A 91% (85%, 97%) 47% (38%, 58%)    Drug B 86% (80%, 93%) 41% (33%, 52%) # Example 4 Competing Events Example --------- # adding a competing event for death (cancer vs other causes) set.seed(1123) library(dplyr, warn.conflicts = FALSE, quietly = TRUE) trial2 <- trial |> dplyr::mutate( death_cr = dplyr::case_when( death == 0 ~ \"censor\", runif(n()) < 0.5 ~ \"death from cancer\", TRUE ~ \"death other causes\" ) |> factor() ) survfit(Surv(ttdeath, death_cr) ~ grade, data = trial2) |> tbl_survfit(times = c(12, 24), label = \"Tumor Grade\") #> Multi-state model detected. Showing probabilities into state 'death from #> cancer'. Characteristic Time 12 Time 24 Tumor Grade     I 2.9% (0.8%, 12%) 26% (18%, 39%)    II 8.8% (4.1%, 19%) 25% (17%, 38%)    III 6.3% (2.4%, 16%) 34% (25%, 48%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_survfit_errors.html","id":null,"dir":"Reference","previous_headings":"","what":"Common Sources of Error with tbl_survfit() — tbl_survfit_errors","title":"Common Sources of Error with tbl_survfit() — tbl_survfit_errors","text":"functions add_n() add_p() run tbl_survfit(), original call survival::survfit() extracted formula= data= arguments used calculate N p-value. values formula= data= unavailable, functions execute. tips modify code ensure functions run without issue. Let tbl_survfit() construct survival::survfit() passing data frame tbl_survfit(). survfit model constructed manner ensuring formula data available. works stratified model. Instead following line Use code Construct expression survival::survfit() evaluating . Ensure formula data available call using tidyverse bang-bang operator, !!. Use code","code":"survfit(Surv(ttdeath, death) ~ trt, trial) %>% tbl_survfit(times = c(12, 24)) trial %>% select(ttdeath, death, trt) %>% tbl_survfit(y = Surv(ttdeath, death), times = c(12, 24)) formula_arg <- Surv(ttdeath, death) ~ 1 data_arg <- trial rlang::expr(survfit(!!formula_arg, !!data_arg)) %>% eval() %>% tbl_survfit(times = c(12, 24))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a table of summary statistics from a survey object — tbl_svysummary","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"tbl_svysummary() function calculates descriptive statistics continuous, categorical, dichotomous variables taking account survey weights design.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"","code":"tbl_svysummary( data, by = NULL, label = NULL, statistic = list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"), digits = NULL, type = NULL, value = NULL, missing = c(\"ifany\", \"no\", \"always\"), missing_text = \"Unknown\", missing_stat = \"{N_miss}\", sort = all_categorical(FALSE) ~ \"alphanumeric\", percent = c(\"column\", \"row\", \"cell\"), include = everything() )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"data (survey.design) survey object created created survey::svydesign() (tidy-select) single column data. Summary statistics stratified variable. Default NULL. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (formula-list-selector) Specifies summary statistics display variable. default list(all_continuous() ~ \"{median} ({p25}, {p75})\", all_categorical() ~ \"{n} ({p}%)\"). See details. digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. missing, missing_text, missing_stat Arguments dictating missing values presented: missing: must one c(\"ifany\", \"\", \"always\") missing_text: string indicating text shown missing row. Default \"Unknown\" missing_stat: statistic show missing row. Default \"{N_miss}\". Possible values N_miss, N_obs, N_nonmiss, p_miss, p_nonmiss. sort (formula-list-selector) Specifies sorting perform categorical variables. Values must one c(\"alphanumeric\", \"frequency\"). Default all_categorical(FALSE) ~ \"alphanumeric\". percent (string) Indicates type percentage return. Must one c(\"column\", \"row\", \"cell\"). Default \"column\". include (tidy-select) Variables include summary table. Default everything().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"'tbl_svysummary' object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"statistic-argument","dir":"Reference","previous_headings":"","what":"statistic argument","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"statistic argument specifies statistics presented table. input list formulas specify statistics report. example, statistic = list(age ~ \"{mean} ({sd})\") report mean standard deviation age; statistic = list(all_continuous() ~ \"{mean} ({sd})\") report mean standard deviation continuous variables. statistic name appears curly brackets replaced numeric statistic (see glue::glue()). categorical variables following statistics available display. {n} frequency {N} denominator, cohort size {p} proportion {p.std.error} standard error sample proportion (0 1 scale) computed survey::svymean() {deff} design effect sample proportion computed survey::svymean() {n_unweighted} unweighted frequency {N_unweighted} unweighted denominator {p_unweighted} unweighted formatted percentage continuous variables following statistics available display. {median} median {mean} mean {mean.std.error} standard error sample mean computed survey::svymean() {deff} design effect sample mean computed survey::svymean() {sd} standard deviation {var} variance {min} minimum {max} maximum {p##} integer percentile, ## integer 0 100 {sum} sum Unlike tbl_summary(), possible pass custom function. categorical continuous variables, statistics number missing non-missing observations proportions available display. {N_obs} total number observations {N_miss} number missing observations {N_nonmiss} number non-missing observations {p_miss} percentage observations missing {p_nonmiss} percentage observations missing {N_obs_unweighted} unweighted total number observations {N_miss_unweighted} unweighted number missing observations {N_nonmiss_unweighted} unweighted number non-missing observations {p_miss_unweighted} unweighted percentage observations missing {p_nonmiss_unweighted} unweighted percentage observations missing Note categorical variables, {N_obs}, {N_miss} {N_nonmiss} refer total number, number missing number non missing observations denominator, level categorical variable.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"type-and-value-arguments","dir":"Reference","previous_headings":"","what":"type and value arguments","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"four summary types. Use type argument change default summary types. \"continuous\" summaries shown single row. numeric variables default summary type continuous. \"continuous2\" summaries shown 2 rows \"categorical\" multi-line summaries nominal data. Character variables, factor variables, numeric variables fewer 10 unique levels default type categorical. change numeric variable continuous defaulted categorical, use type = list(varname ~ \"continuous\") \"dichotomous\" categorical variables displayed single row, rather one row per level variable. Variables coded TRUE/FALSE, 0/1, yes/assumed dichotomous, TRUE, 1, yes rows displayed. Otherwise, value display must specified value argument, e.g. value = list(varname ~ \"level show\")","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"Joseph Larmarange","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_svysummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a table of summary statistics from a survey object — tbl_svysummary","text":"","code":"# Example 1 ---------------------------------- survey::svydesign(~1, data = as.data.frame(Titanic), weights = ~Freq) |> tbl_svysummary(by = Survived, percent = \"row\", include = c(Class, Age)) Characteristic No N = 1,4901 Yes N = 7111 Class     1st 122 (38%) 203 (62%)    2nd 167 (59%) 118 (41%)    3rd 528 (75%) 178 (25%)    Crew 673 (76%) 212 (24%)Age     Child 52 (48%) 57 (52%)    Adult 1,438 (69%) 654 (31%)1 n (%) # Example 2 ---------------------------------- # A dataset with a complex design data(api, package = \"survey\") survey::svydesign(id = ~dnum, weights = ~pw, data = apiclus1, fpc = ~fpc) |> tbl_svysummary(by = \"both\", include = c(api00, stype)) |> modify_spanning_header(all_stat_cols() ~ \"**Survived**\") Characteristic Survived No N = 1,6921 Yes N = 4,5021 api00 631 (559, 710) 655 (551, 723)stype     E 1,083 (64%) 3,791 (84%)    H 237 (14%) 237 (5.3%)    M 372 (22%) 474 (11%)1 Median (Q1, Q3); n (%)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":null,"dir":"Reference","previous_headings":"","what":"Univariable regression model summary — tbl_uvregression","title":"Univariable regression model summary — tbl_uvregression","text":"function estimates univariable regression models returns publication-ready table. can create regression models holding either covariate outcome constant.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Univariable regression model summary — tbl_uvregression","text":"","code":"tbl_uvregression(data, ...) # S3 method for class 'data.frame' tbl_uvregression( data, y = NULL, x = NULL, method, method.args = list(), exponentiate = FALSE, label = NULL, include = everything(), tidy_fun = broom.helpers::tidy_with_broom_or_parameters, hide_n = FALSE, show_single_row = NULL, conf.level = 0.95, estimate_fun = ifelse(exponentiate, label_style_ratio(), label_style_sigfig()), pvalue_fun = label_style_pvalue(digits = 1), formula = \"{y} ~ {x}\", add_estimate_to_reference_rows = FALSE, conf.int = TRUE, ... ) # S3 method for class 'survey.design' tbl_uvregression( data, y = NULL, x = NULL, method, method.args = list(), exponentiate = FALSE, label = NULL, include = everything(), tidy_fun = broom.helpers::tidy_with_broom_or_parameters, hide_n = FALSE, show_single_row = NULL, conf.level = 0.95, estimate_fun = ifelse(exponentiate, label_style_ratio(), label_style_sigfig()), pvalue_fun = label_style_pvalue(digits = 1), formula = \"{y} ~ {x}\", add_estimate_to_reference_rows = FALSE, conf.int = TRUE, ... )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Univariable regression model summary — tbl_uvregression","text":"data (data.frame, survey.design) data frame survey design object. ... Additional arguments passed broom.helpers::tidy_plus_plus(). y, x (expression, string) Model outcome (e.g. y=recurrence y=Surv(time, recur)) covariate (e.g. x=trt. column specified include regressed constant y x. Specify one one y x. method (string/function) Regression method function, e.g. lm, glm, survival::coxph, survey::svyglm, etc. Methods may passed functions (method=lm) strings (method='lm'). method.args (named list) Named list arguments passed method. exponentiate (scalar logical) Logical indicating whether exponentiate coefficient estimates. Default FALSE. label (formula-list-selector) Used change variables labels, e.g. list(age = \"Age\", stage = \"Path T Stage\") include (tidy-select) Variables include output. Default everything(). tidy_fun (function) Tidier function model. Default use broom::tidy(). error occurs, tidying model attempted parameters::model_parameters(), installed. hide_n (scalar logical) Hide N column. Default FALSE show_single_row (tidy-select) default categorical variables printed multiple rows. variable dichotomous (e.g. Yes/) wish print regression coefficient single row, include variable name(s) . conf.level (scalar real) Confidence level confidence interval/credible interval. Defaults 0.95. estimate_fun (function) Function round format coefficient estimates. Default label_style_sigfig() coefficients transformed, label_style_ratio() coefficients exponentiated. pvalue_fun (function) Function round format p-values. Default label_style_pvalue(). formula (string) String model formula. Uses glue::glue() syntax. Default \"{y} ~ {x}\", {y} dependent variable, {x} represents single covariate. random intercept model, formula may formula = \"{y} ~ {x} + (1 | gear)\". add_estimate_to_reference_rows (scalar logical) Add reference value. Default FALSE. conf.int (scalar logical) Logical indicating whether include confidence interval output. Default TRUE.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Univariable regression model summary — tbl_uvregression","text":"tbl_uvregression object","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"x-and-y-arguments","dir":"Reference","previous_headings":"","what":"x and y arguments","title":"Univariable regression model summary — tbl_uvregression","text":"models holding outcome constant, function takes arguments data frame, type regression model, outcome variable y=. column data frame regressed specified outcome. tbl_uvregression() function arguments similar tbl_regression() arguments. Review tbl_uvregression vignette detailed examples. may alternatively hold single covariate constant. , pass data frame, type regression model, single covariate x= argument. column data frame serve outcome univariate regression model. Take care using x argument columns data frame appropriate type model, e.g. continuous variables appropriate lm, dichotomous variables appropriate logistic regression glm.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Univariable regression model summary — tbl_uvregression","text":"default method tbl_regression() model summary uses broom::tidy(x) perform initial tidying model object. , however, models use modifications. \"parsnip/workflows\": model prepared using parsnip/workflows, original model fit extracted original x= argument replaced model fit. typically go unnoticed; however,provided custom tidier tidy_fun= tidier applied model fit object parsnip/workflows object. \"survreg\": scale parameter removed, broom::tidy(x) %>% dplyr::filter(term != \"Log(scale)\") \"multinom\": multinomial outcome complex, one line per covariate per outcome (less reference group) \"gam\": Uses internal tidier tidy_gam() print parametric smooth terms. \"lmerMod\", \"glmerMod\", \"glmmTMB\", \"glmmadmb\", \"stanreg\", \"brmsfit\": mixed effects models use broom.mixed::tidy(x, effects = \"fixed\"). Specify tidy_fun = broom.mixed::tidy print random components.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Univariable regression model summary — tbl_uvregression","text":"Daniel D. Sjoberg","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_uvregression.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Univariable regression model summary — tbl_uvregression","text":"","code":"# Example 1 ---------------------------------- tbl_uvregression( trial, method = glm, y = response, method.args = list(family = binomial), exponentiate = TRUE, include = c(\"age\", \"grade\") ) Characteristic N OR 95% CI p-value Age 183 1.02 1.00, 1.04 0.10Grade 193     I — —     II 0.95 0.45, 2.00 0.9    III 1.10 0.52, 2.29 0.8Abbreviations: CI = Confidence Interval, OR = Odds Ratio # Example 2 ---------------------------------- # rounding pvalues to 2 decimal places library(survival) tbl_uvregression( trial, method = coxph, y = Surv(ttdeath, death), exponentiate = TRUE, include = c(\"age\", \"grade\", \"response\"), pvalue_fun = label_style_pvalue(digits = 2) ) Characteristic N HR 95% CI p-value Age 189 1.01 0.99, 1.02 0.33Grade 200     I — —     II 1.28 0.80, 2.05 0.31    III 1.69 1.07, 2.66 0.024Tumor Response 193 0.50 0.31, 0.78 0.003Abbreviations: CI = Confidence Interval, HR = Hazard Ratio"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":null,"dir":"Reference","previous_headings":"","what":"Wide summary table — tbl_wide_summary","title":"Wide summary table — tbl_wide_summary","text":"function similar tbl_summary(), places summary statistics wide, separate columns. included variables must summary type, e.g. continuous summaries categorical summaries (encompasses dichotomous variables).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Wide summary table — tbl_wide_summary","text":"","code":"tbl_wide_summary( data, label = NULL, statistic = switch(type[[1]], continuous = c(\"{median}\", \"{p25}, {p75}\"), c(\"{n}\", \"{p}%\")), digits = NULL, type = NULL, value = NULL, sort = all_categorical(FALSE) ~ \"alphanumeric\", include = everything() )"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Wide summary table — tbl_wide_summary","text":"data (data.frame) data frame. label (formula-list-selector) Used override default labels summary table, e.g. list(age = \"Age, years\"). default variable column label attribute, attr(., 'label'). label set, column name used. statistic (character) character vector statistics present. element vector result column summary table. Default c(\"{median}\", \"{p25}, {p75}\") continuous summaries, c(\"{n}\", \"{p}%\") categorical/dichotomous summaries digits (formula-list-selector) Specifies summary statistics rounded. Values may either integer(s) function(s). specified, default formatting assigned via assign_summary_digits(). See details. type (formula-list-selector) Specifies summary type. Accepted value c(\"continuous\", \"continuous2\", \"categorical\", \"dichotomous\"). specified, default type assigned via assign_summary_type(). See details. value (formula-list-selector) Specifies level variable display single row. gtsummary type selectors, e.g. all_dichotomous(), used argument. Default NULL. See details. sort (formula-list-selector) Specifies sorting perform categorical variables. Values must one c(\"alphanumeric\", \"frequency\"). Default all_categorical(FALSE) ~ \"alphanumeric\". include (tidy-select) Variables include summary table. Default everything().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Wide summary table — tbl_wide_summary","text":"gtsummary table class 'tbl_wide_summary'","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tbl_wide_summary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Wide summary table — tbl_wide_summary","text":"","code":"trial |> tbl_wide_summary(include = c(response, grade)) Characteristic n % Tumor Response 61 32%Grade     I 68 34%    II 68 34%    III 64 32% trial |> tbl_strata( strata = trt, ~tbl_wide_summary(.x, include = c(age, marker)) ) Characteristic Drug A Drug B Median Q1, Q3 Median Q1, Q3 Age 46 37, 60 48 39, 56Marker Level (ng/mL) 0.84 0.23, 1.60 0.52 0.18, 1.21"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tests.html","id":null,"dir":"Reference","previous_headings":"","what":"Tests/methods available in add_p() and add_difference() — tests","title":"Tests/methods available in add_p() and add_difference() — tests","text":"listing tests available internally within gtsummary. Tests listed ... may additional arguments passed using add_p(test.args=). example, calculate p-value t.test() assuming equal variance, use tbl_summary(trial, = trt) %>% add_p(age ~ \"t.test\", test.args = age ~ list(var.equal = TRUE))","code":""},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tests.html","id":"custom-functions","dir":"Reference","previous_headings":"","what":"Custom Functions","title":"Tests/methods available in add_p() and add_difference() — tests","text":"report p-value (difference) test available gtsummary, can create custom function. output data frame one line long. structure similar output broom::tidy() typical statistical test. add_p() add_difference() functions look columns called \"p.value\", \"estimate\", \"statistic\", \"std.error\", \"parameter\", \"conf.low\", \"conf.high\", \"method\". can also pass Analysis Results Dataset (ARD) object results custom result. objects follow structures outlined {cards} {cardx} packages. Example calculating p-value t-test assuming common variance groups. custom add_difference() similar, accepts arguments conf.level= adj.vars= well.","code":"ttest_common_variance <- function(data, variable, by, ...) { data <- data[c(variable, by)] %>% dplyr::filter(complete.cases(.)) t.test(data[[variable]] ~ factor(data[[by]]), var.equal = TRUE) %>% broom::tidy() } trial[c(\"age\", \"trt\")] %>% tbl_summary(by = trt) %>% add_p(test = age ~ \"ttest_common_variance\") ttest_common_variance <- function(data, variable, by, conf.level, ...) { data <- data[c(variable, by)] %>% dplyr::filter(complete.cases(.)) t.test(data[[variable]] ~ factor(data[[by]]), conf.level = conf.level, var.equal = TRUE) %>% broom::tidy() }"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tests.html","id":"function-arguments","dir":"Reference","previous_headings":"","what":"Function Arguments","title":"Tests/methods available in add_p() and add_difference() — tests","text":"tbl_summary() objects, custom function passed following arguments: custom_pvalue_fun(data=, variable=, =, group=, type=, conf.level=, adj.vars=). function may utilize arguments, arguments passed function must accept . recommend including ... future-proof updates additional arguments added. following table describes argument inputs gtsummary table type.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":null,"dir":"Reference","previous_headings":"","what":"Available gtsummary themes — theme_gtsummary","title":"Available gtsummary themes — theme_gtsummary","text":"following themes available use within gtsummary package. Print theme elements theme_gtsummary_journal(set_theme = FALSE) |> print(). Review themes vignette details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Available gtsummary themes — theme_gtsummary","text":"","code":"theme_gtsummary_journal( journal = c(\"jama\", \"lancet\", \"nejm\", \"qjecon\"), set_theme = TRUE ) theme_gtsummary_compact(set_theme = TRUE, font_size = NULL) theme_gtsummary_printer( print_engine = c(\"gt\", \"kable\", \"kable_extra\", \"flextable\", \"huxtable\", \"tibble\"), set_theme = TRUE ) theme_gtsummary_language( language = c(\"de\", \"en\", \"es\", \"fr\", \"gu\", \"hi\", \"is\", \"ja\", \"kr\", \"mr\", \"nl\", \"no\", \"pt\", \"se\", \"zh-cn\", \"zh-tw\"), decimal.mark = NULL, big.mark = NULL, iqr.sep = NULL, ci.sep = NULL, set_theme = TRUE ) theme_gtsummary_continuous2( statistic = \"{median} ({p25}, {p75})\", set_theme = TRUE ) theme_gtsummary_mean_sd(set_theme = TRUE) theme_gtsummary_eda(set_theme = TRUE)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Available gtsummary themes — theme_gtsummary","text":"journal String indicating journal theme follow. One c(\"jama\", \"lancet\", \"nejm\", \"qjecon\"). Details . set_theme (scalar logical) Logical indicating whether set theme. Default TRUE. FALSE named list theme elements returned invisibly font_size (scalar numeric) Numeric font size compact theme. Default 13 gt tables, 8 output types print_engine String indicating print method. Must one \"gt\", \"kable\", \"kable_extra\", \"flextable\", \"tibble\" language (string) String indicating language. Must one \"de\" (German), \"en\" (English), \"es\" (Spanish), \"fr\" (French), \"gu\" (Gujarati), \"hi\" (Hindi), \"\" (Icelandic),\"ja\" (Japanese), \"kr\" (Korean), \"nl\" (Dutch), \"mr\" (Marathi), \"\" (Norwegian), \"pt\" (Portuguese), \"se\" (Swedish), \"zh-cn\" (Chinese Simplified), \"zh-tw\" (Chinese Traditional) language missing translation word phrase, please feel free reach GitHub translated text. decimal.mark (string) character used indicate numeric decimal point. Default \".\" getOption(\"OutDec\") big.mark (string) Character used every 3 digits separate hundreds/thousands/millions/etc. Default \",\", except decimal.mark = \",\" default space. iqr.sep (string) String indicating separator default IQR tbl_summary(). decimal.mark= NULL, iqr.sep= \", \". comma separator, however, can look odd decimal.mark = \",\". case argument default en dash ci.sep (string) String indicating separator confidence intervals. decimal.mark= NULL, ci.sep= \", \". comma separator, however, can look odd decimal.mark = \",\". case argument default en dash statistic Default statistic continuous variables","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":"themes","dir":"Reference","previous_headings":"","what":"Themes","title":"Available gtsummary themes — theme_gtsummary","text":"theme_gtsummary_journal(journal) \"jama\" Journal American Medical Association Round large p-values 2 decimal places; separate confidence intervals \"ll ul\". tbl_summary() show percent symbol; use em-dash separate IQR; run add_stat_label() tbl_regression()/tbl_uvregression() show coefficient CI column \"lancet\" Lancet Use mid-point decimal separator; round large p-values 2 decimal places; separate confidence intervals \"ll ul\". tbl_summary() show percent symbol; use em-dash separate IQR \"nejm\" New England Journal Medicine Round large p-values 2 decimal places; separate confidence intervals \"ll ul\". tbl_summary() show percent symbol; use em-dash separate IQR \"qjecon\" Quarterly Journal Economics tbl_summary() percentages rounded one decimal place tbl_regression(),tbl_uvregression() add significance stars add_significance_stars(); hides CI p-value output flextable huxtable output, coefficients' standard error placed . gt, placed right. theme_gtsummary_compact() tables printed gt, flextable, kableExtra, huxtable compact smaller font size reduced cell padding theme_gtsummary_printer(print_engine) Use theme permanently change default printer. theme_gtsummary_continuous2() Set continuous variables summary type \"continuous2\" default theme_gtsummary_mean_sd() Set default summary statistics mean standard deviation tbl_summary() Set default continuous tests add_p() t-test ANOVA theme_gtsummary_eda() Set continuous variables summary type \"continuous2\" default tbl_summary() show median, mean, IQR, SD, Range default Use reset_gtsummary_theme() restore default settings Review themes vignette create themes.","code":""},{"path":[]},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/theme_gtsummary.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Available gtsummary themes — theme_gtsummary","text":"","code":"# Setting JAMA theme for gtsummary theme_gtsummary_journal(\"jama\") #> Setting theme \"JAMA\" # Themes can be combined by including more than one theme_gtsummary_compact() #> Setting theme \"Compact\" trial |> select(age, grade, trt) |> tbl_summary(by = trt) |> as_gt() Characteristic Drug A N = 98 Drug B N = 102 Age, Median (IQR) 46 (37 – 60) 48 (39 – 56)    Unknown 7 4Grade, n (%)     I 35 (36) 33 (32)    II 32 (33) 36 (35)    III 31 (32) 33 (32) # reset gtsummary themes reset_gtsummary_theme()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tibble_as_cli.html","id":null,"dir":"Reference","previous_headings":"","what":"Print tibble with cli — tibble_as_cli","title":"Print tibble with cli — tibble_as_cli","text":"Print tibble data frame using cli styling formatting.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tibble_as_cli.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Print tibble with cli — tibble_as_cli","text":"","code":"tibble_as_cli(x, na_value = \"\", label = list(), padding = 3L)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tibble_as_cli.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Print tibble with cli — tibble_as_cli","text":"x (data.frame) data frame character columns. na_value (string) string indicating NA value appear printed table. label (named list) named list column labels use. Default print column names. padding (integer) integer indicating amount padding columns.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/tibble_as_cli.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Print tibble with cli — tibble_as_cli","text":"","code":"trial[1:3, ] |> dplyr::mutate_all(as.character) |> gtsummary:::tibble_as_cli() #> trt age marker stage grade response death ttdeath trt #> Drug A 23 0.16 T1 II 0 0 24 age #> Drug B 9 1.107 T2 I 1 0 24 marker #> Drug A 31 0.277 T1 II 0 0 24 stage"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/trial.html","id":null,"dir":"Reference","previous_headings":"","what":"Results from a simulated study of two chemotherapy agents — trial","title":"Results from a simulated study of two chemotherapy agents — trial","text":"dataset containing baseline characteristics 200 patients received Drug Drug B. Dataset also contains outcome tumor response treatment.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/trial.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Results from a simulated study of two chemotherapy agents — trial","text":"","code":"trial"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/trial.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Results from a simulated study of two chemotherapy agents — trial","text":"data frame 200 rows–one row per patient trt Chemotherapy Treatment age Age marker Marker Level (ng/mL) stage T Stage grade Grade response Tumor Response death Patient Died ttdeath Months Death/Censor","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/vec_to_df.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert character vector to data frame — vec_to_df","title":"Convert character vector to data frame — vec_to_df","text":"used selecting allow , example as_gt(include=) can use tidyselect select among call names include.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/vec_to_df.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert character vector to data frame — vec_to_df","text":"","code":"vec_to_df(x)"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/vec_to_df.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert character vector to data frame — vec_to_df","text":"x character vector","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/reference/vec_to_df.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert character vector to data frame — vec_to_df","text":"data frame","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-development-version","dir":"Changelog","previous_headings":"","what":"gtsummary (development version)","title":"gtsummary (development version)","text":"Updates handling footnotes. Previously, header footnotes handled modify_footnote() modify_table_styling(footnote). possible also include footnotes table body modify_table_styling(footnote), largely hidden feature. Also confusingly, special abbreviation footnote handled modify_footnote(abbreviation=TRUE). update, now export separate user-facing functions clearer names scope: modify_footnote_header(), modify_footnote_body(), modify_abbreviation(). names indicate, modify_footnote_header() modify_footnote_body() functions place footnotes header table body. Abbreviations now treated like source notes footnote markers associated . also export functions remove_footnote_header(), remove_footnote_body(), remove_abbreviation() remove previously assigned footnotes abbreviations. Also, multiple footnotes may now reference cell table column header utilizing modify_footnote_header(replace=FALSE), modify_footnote_body(replace=FALSE) argument. Previously, source notes undocumented feature single source note included table. now export modify_source_note() remove_source_note() add remove number source notes. Also, merging stacking tables, previously due one source note limit, first source note retained. Now source notes included resulting table. different behavior compared previous versions package rare cases may result different source note. Moreover, kableExtra output now supports source notes, previously omitted.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-204","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.4","title":"gtsummary 2.0.4","text":"CRAN release: 2024-11-30","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-features-and-functions-2-0-4","dir":"Changelog","previous_headings":"","what":"New Features and Functions","title":"gtsummary 2.0.4","text":"Added S3 methods add_overall.tbl_hierarchical() add_overall.tbl_hierarchical_count(). Added tidy_wald_test(vcov) argument allow calculation p-values via alternative variance-covariance structure (e.g. robust SEs). (#2076; @aghaynes)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-2-0-4","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 2.0.4","text":"with_gtsummary_theme() updated longer print theme names applied, original theme re-applied. (#2031) Updated theme_gtsummary_journal(\"jama\") theme apply changes tbl_svysummary(). (#1964; @vjcatharine)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"lifecycle-updates-2-0-4","dir":"Changelog","previous_headings":"","what":"Lifecycle Updates","title":"gtsummary 2.0.4","text":"Removed global_pvalue_fun.tidycrr(), previously migrated {tidycmprsk} package. (#1997; @jwoolfolk)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-2-0-4","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 2.0.4","text":"Bug fix footnote markers placing footnote flextable gt tables multiple columns rows table body. (#2062) Fix setting default formatting functions tbl_svysummary(). Previously, defaults assigned similarly tbl_summary(), led survey-statistics assigned sub-optimal defaults. (#2078) Bug fix add_ci.tbl_svysummary() factor variables order alphabetical instead factor levels. (#2036) Addressing encoding issue sort() dplyr::arrange() sorted differently, order levels inconsistent resulting table. (#2038) Users may now pass vector integers tbl_hierarchical*(digits), possible summary functions. (#2080)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-203","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.3","title":"gtsummary 2.0.3","text":"CRAN release: 2024-10-04","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-features-and-functions-2-0-3","dir":"Changelog","previous_headings":"","what":"New Features and Functions","title":"gtsummary 2.0.3","text":"Added function tbl_hierarchical(), tbl_hierarchical_count(), tbl_ard_hierarchical(), brdg_hierarchical(), pier_summary_hierarchical(). Consider functions preview. making changes without full deprecation cycle coming releases. (#1872) Adding style_*(prefix, suffix) label_style_*(prefix, suffix) adding string formatted results. arguments added p-value formatting functions. (#1690) Added argument tbl_ard_summary(overall). TRUE, ARD parsed primary ARD Overall ARD run tbl_ard_summary() |> add_overall(). (#1940) Added add_stat_label.tbl_ard_summary() method. (#1969)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-2-0-3","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 2.0.3","text":"Headers {gt} tables exported PDF support \\n line breaker. Previously, line breakers stripped header print.gtsummary() S3 method. apply users utilizing as_gt() customize tables. result, line breaking strip migrated as_gt(). (#1960) Migrated tbl_survfit.list(conf.level) tbl_survfit.data.frame(conf.level) confidence level passed survival::survfit(). Update tbl_ard_summary() better handle non-standard ARDs (.e. typical continuous categorical summaries) assigning default summary type. (#1991) Made oneway.test() available add_p.tbl_continuous(). (#1970) Removed deprecated 'aov' test tests.R file listing available tests. (#1970) Removed documentation add_overall.tbl_ard_summary(digits) argument, never meant part function. (#1975)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-2-0-3","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 2.0.3","text":"Bug fix add_overall.tbl_custom_summary() due extraneous argument passed tbl_custom_summary(). (#2027) Bug fix add_p.tbl_survfit() original call included tbl_survfit(type) specification. (#2002) Removed \"tbl_summary-arg:statistic\" theme incorrectly added tbl_continuous().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-202","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.2","title":"gtsummary 2.0.2","text":"CRAN release: 2024-09-05 Updates address regressions v2.0.0 release: default add_glance_*(glance_fun) function fixed mice models class 'mira'. (#1912) can report unweighted statistics headers tbl_svysummary() tables. (#1911) tbl_uvregression() properly handles variables specified include argument non-syntactic names. (#1932) NA values can specified add_stat_label(label) suppress statistic label placed. (#1937) Corrected bug tbl_cross() digits argument always passed accurately tbl_summary(). (#1943)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-2-0-2","dir":"Changelog","previous_headings":"","what":"Other updates","title":"gtsummary 2.0.2","text":"Themes Inline Text vignettes converted articles (, longer bundled package, still available website). total N now returned .$cards using cards::ard_total_n() function calculation. default headers tbl_ard_*() functions longer include counts, required data passed along ARD input. summary statistics '' variable longer required ARD functions tbl_ard_summary() tbl_ard_continuous(). tabulation summary statistics passed, available place header dynamically. (#1860) tbl_ard_wide_summary() function longer requires results cards::ard_attributes() create tables. (#1873) Added label argument functions tbl_ard_summary(), tbl_ard_wide_summary(), tbl_ard_continuous(). (#1850) add_glance*(glance_fun) argument’s default value updated S3 generic, allowing bespoke handling regression classes. (#1822) Added add_overall.tbl_ard_summary() S3 method. (#1848) Added function tbl_likert() summarizing ordered categorical (Likert scales) data well associated add_n.tbl_likert() S3 method. (#1660) Fix error warning condition messages containing curly brace pairs printed. Updated show_header_names() output include values may dynamically placed headers. Additionally, include_example quiet arguments deprecated. (#1696)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-201","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.1","title":"gtsummary 2.0.1","text":"CRAN release: 2024-08-17 Updates address regressions v2.0.0 release: Restore functionality inline_text.tbl_summary(column) argument specify level variable factor. (#1883) Correct order columns tbl_summary() variables ten levels. (#1877) Re-establishing strong link header variable levels table body ensure correct ordering columns tbl_summary(). tbl_survfit(times) argument accepts integers . (#1867) Fix tbl_uvregression() formula argument includes hard-coded column name, e.g. formula='{y} ~ {x} + grade'. hard-coded variable name now removed include argument. (#1886) Fix non-Base R classes tabulated tbl_summary() coerce character correctly unlist(). (#1893) Updated styling function style_percent() style_number(scale=100) user passes integer change rounding percentages tbl_summary(). (#1899)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-2-0-1","dir":"Changelog","previous_headings":"","what":"Other updates","title":"gtsummary 2.0.1","text":"{tidycmprsk} dependency removed tbl_regression.tidycrr() method migrated {tidycmprsk} package. (#1865) class tbl_split() objects updated \"tbl_split\" c(\"tbl_split\", \"list\"). (#1854) Updated default value tbl_ard_summary(missing) \"\". (#1857) Line breaks (.e. '\\n') now auto-stripped gt-rendered tables R markdown Quarto environment. (#1896)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-200","dir":"Changelog","previous_headings":"","what":"gtsummary 2.0.0","title":"gtsummary 2.0.0","text":"CRAN release: 2024-07-23","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-features-2-0-0","dir":"Changelog","previous_headings":"","what":"New Features","title":"gtsummary 2.0.0","text":"Clearer error messages introduced throughout package. ’ve adopted {cli} messaging users. goal return clear message users scenarios. Added functions tbl_wide_summary() tbl_ard_wide_summary() simple summaries across multiple columns. {gt} package now default printer Quarto R markdown output formats. Previously, printing gtsummary table Quarto R markdown document, detect output format convert gt, flextable, kable provide best-looking table. {gt} package matured provides lovely tables nearly output types, now made {gt} default table drawing tool gtsummary tables. output types still supported. Previously, wanted single statistic reported additional levels precision tbl_summary() table, need specify precision every summary statistic variable. Now, can simple update one statistic ’re interested named list vector: tbl_summary(digits = age ~ list(sd = 2)). New functions tbl_ard_summary() tbl_ard_continuous() added. provide general tools creating bespoke summary tables. Rather accepting data frame, functions accept ARD object (Analysis Results Dataset often created {cards} {cardx} packages). ARD objects align emerging CDISC Analysis Results Standard. ARDs now used throughout package. See “Internal Storage” heading. default add_global_p(anova_fun) argument value updated global_pvalue_fun(), S3 generic. default method still calls car::Anova() calculation. Methods tidycmprsk::crr() geepack::geeglm() added wrap aod::wald.test() regression model types supported car::Anova(). add_ci.tbl_summary() S3 method updated new ways calculate confidence interval: Wald without continuity correction, Agresti-Coull, Jeffreys. Added family function label_style_*() similar style_*() except return styling function, rather styled value. Functions tbl_summary() tbl_svysummary() gained missing_stat argument, gives users great control statistics presented missing row summary table.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"internal-storage-2-0-0","dir":"Changelog","previous_headings":"","what":"Internal Storage","title":"gtsummary 2.0.0","text":"Greater consistency put place calculated statistics gtsummary. Previously, function handled calculations transforming statistics data frames printed. Now function first prepare Analysis Result Dataset (ARD), ARDs converted gtsummary structures using bridge functions (prefixed brdg_*()). bridge functions exported allow anyone easily extend gtsummary functions. ARDs now used calculate summary statistics nearly every function gtsummary. raw summary statistics saved .$cards. Users previously accessed internals gtsummary object find structure updated, may important breaking change. Calculations require packages placed another package called {cardx}. package creates ARD objects calculated statistics. tbl_regression(), .$model_obj longer returned object. modeling object , always , available .$inputs$x. gtsummary package first written, gt package CRAN version package available ability merge columns. Due limitations, \"ci\" column added show combined \"conf.low\" \"conf.high\" columns. Column merging gt gtsummary packages matured years, now adopting modern approach using features. result, \"ci\" column eventually dropped .$table_body. using column merging, conf.low conf.high remain numeric can continue update columns formatted. Review ?deprecated_ci_column details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"documentation-2-0-0","dir":"Changelog","previous_headings":"","what":"Documentation","title":"gtsummary 2.0.0","text":"vignettes “FAQ+Gallery”, tbl_summary() Tutorial, tbl_regression() Tutorial, Quarto+R Markdown converted articles. URLs website changed pages, vignettes longer bundled package. change allows us provide better documentation, utilizing tools don’t need included package.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"minor-improvements-2-0-0","dir":"Changelog","previous_headings":"","what":"Minor Improvements","title":"gtsummary 2.0.0","text":"Argument add_p.tbl_summary(adj.vars) added easily add p-values adjusted/stratified columns data frame. Messaging checks improved tidyselect invoked package, .e. tilda used select variables age ~ \"Patient Age\". subset variables can selected now reduced variables present table. example, summary table patient age (patient age), age single column data set many columns mis-spell age (aggge ~ \"Patient Age\"), error message now ask meant \"age\" instead listing every column data set. Note , can circumvent tidyselect using named list, e.g. list(age = \"Patient Age\"). Added following methods calculating differences add_difference.tbl_summary(): Hedge’s G, Paired data Cohen’s D, Paired data Hedge’s G. three powered {effectsize} package. counts header tbl_summary() tables now appear new line, e.g. \"**{level}** \\nN = {n}\". tbl_summary(), default calculation quantiles (e.g. statistics form \"p25\" \"p75\") updated type quantile(type=2). tbl_summary(), dates times showed minimum maximum values default. now treated continuous summaries share default statistics median IQR. Previously, indentation handled modify_table_styling(text_format = c(\"indent\", \"indent2\")), indent cell 4 8 spaces, respectively. Handling indentation migrated modify_table_styling(indent = integer()), default, label column indented zero spaces. makes easier indent group rows. inputs modify_table_styling(undo_text_format) updated mirror counterpart modify_table_styling(text_format) longer accepts TRUE FALSE. values passed tbl_summary(value) now checked columns summary type \"dichotomous\". gtsummary selecting functions, e.g. all_categorical(), all_continuous(), etc., now simplified wrapping tidyselect::(), available functions originally written. Previously, functions error used context; now, instead,select columns used --context. design-based t-test added possible methods add_difference.tbl_svysummary() now default continuous variables. add_ci() run add_overall(), overall column now populated confidence interval. (#1569) Added pkgdown_print.gtsummary() method registered pkgdown package loaded. enables printing gtsummary tables pkgdown site Examples section. (#1771) package now uses updated survey::svyquantile() function calculate quantiles, introduced survey v4.1","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-2-0-0","dir":"Changelog","previous_headings":"","what":"Bug fixes","title":"gtsummary 2.0.0","text":"Fix add_difference() paired t-tests. Previously, sign reported difference depended group appeared first source data. Function updated consistently report difference first group mean minus second group mean. (#1557)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"lifecycle-changes-2-0-0","dir":"Changelog","previous_headings":"","what":"Lifecycle changes","title":"gtsummary 2.0.0","text":"couple small changes default summary type tbl_summary() made. column NA_character_ tbl_summary(), default summary type now \"continuous\", previously \"dichotomous\". Previously, tbl_summary() variables c(0, 1), c(\"\", \"yes\"), c(\"\", \"Yes\"), c(\"\", \"YES\") default dichotomous summary 1 yes level shown table. occur even case , example, 0 observed. release, line shown dichotomous variables must observed unobserved level must either explicitly defined factor logical vector. means character vector \"yes\" \"\" values default categorical summary instead dichotomous. using tbl_summary(value) argument, longer allow unobserved levels used unless unobserved factor level logical level. quiet argument deprecated throughout package, except tbl_stack(). Documentation updated ensure clarity methods. inline_text(level) argument now expects character value. tbl_butcher(include) argument now accepts character vectors. following theme elements deprecated: pvalue_fun elements switch package-wide theme p-value styling–'pkgwide-fn:pvalue_fun'. default statistics can still modified 'tbl_summary-arg:statistic' add_p(test = ~'aov') test now deprecated identical results can obtained add_p(test = ~'oneway.test', test.args = ~list(var.equal = TRUE)). Previously, add_p.tbl_summary() coerce various data types classes compatible base R tests. example, convert difftime classes general numeric passing wilcox.test(). eliminated type- class-specific handling functions now left user pass data compatible functions calculate p-values create custom test wraps wilcox.test() performs conversion. change effective immediately. Arguments modify_header(update), modify_footnote(update), modify_spanning_header(update), modify_fmt_fun(update) deprecated. Use dynamic dots instead, e.g. modify_header(...), preferred method passing updates years. Function continuous_summary() deprecated immediately. Apologies inconvenience immediate deprecation. way function originally worked compatible updated internal structures. cases, users can use tbl_continuous() function instead. Arguments add_stat(fmt_fun, header, footnote, new_col_name) deprecated since v1.4.0 (2021-04-13). now fully removed package. Global options deprecated gtsummary since v1.3.1 (2020-06-02). now fully removed package. modify_header(stat_by) argument deprecated v1.3.6 (2021-01-08), now fully removed package. Use vars() selector first removed v1.2.5 (2020-02-11), messaging deprecation kicked June 2022. use now defunct function soon longer exported. as_flextable() function deprecated v1.3.3 (2020-08-11), now fully removed package. Custom selectors all_numeric(), all_character(), all_integer(), all_double(), all_logical(), all_factor() functions deprecated v1.3.6 (2021-01-08), now fully removed package. functions added tidyselect::() function released, replacement functions. modify_cols_merge() functions renamed modify_column_merge() match function names v1.6.1 (2022-06-22). deprecation upgraded warning error. change theme_gtsummary_journal(\"qjecon\") theme gt output. journal prefers present regression coefficients standard errors. achieve placement gt table, taking advantage bug feature (depending point view) allowed placement gt table output HTML HTML . gt package now working proper solution linebreaks within cell, feature active, using hack. change theme tabling engine packages.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-172","dir":"Changelog","previous_headings":"","what":"gtsummary 1.7.2","title":"gtsummary 1.7.2","text":"CRAN release: 2023-07-15 Removed messaging former auto-removal tbl_summary(group) variable table: change occurred 3+ years ago gtsummary v1.3.1 Fix as_flex_table() source notes accurately rendered. (#1520) Fix column order add_ci() run add_overall(last=TRUE). Previously, overall columns placed front. (#1525) Line breaks (.e. \\n) now removed column headers table cells as_kable() called. (#1526) Fix as_gt() columns common spanning headers gathered. Corrected gt::tab_spanner(gather = FALSE). (#1527) Fix remove_row_type() header rows continuous2 type variables removed requested. (#1507) Fix default add_p.tbl_summary() categorical tests chi-squared Fisher’s exact test. misclassification occurred cases large differential missing pattern one variables cross table. (#1513) Fix add_overall(col_label=) specified label always placed. (#1505)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-171","dir":"Changelog","previous_headings":"","what":"gtsummary 1.7.1","title":"gtsummary 1.7.1","text":"CRAN release: 2023-04-27","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-7-1","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.7.1","text":"Added .data.frame() S3 method gtsummary class.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-7-1","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.7.1","text":"tbl_svysummary() function may now report design effect, e.g. tbl_svysummary(statistic = ~\"{deff}\"). (#1486) Added French translations new marginal effects tidiers housed {broom.helpers}. (#1417) Added theme elements control default headers tbl_svysummary(). (#1452) Improved error messaging tbl_uvregression() method= argument correctly specified. (#1469) Updates account changes {forcats} v1.0.0 {dplyr} v1.1.0. tbl_svysummary() can now report design effects (#1486)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-7-1","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.7.1","text":"Fix footnote add_overall() run tbl_continuous(). (#1436) Updating levels precision used round2(), used background every rounded/formatted number gtsummary table. (#1494) Bug fix subset CIs requested add_ci(include=). (#1484) Update as_hux_table() ensure Ns header incorrectly auto-formatted {huxtable}. Fix style_*() family functions. attributes input vector–excluding class–retained. (#1460) Updated style_ratio() now format negative values. Bug fix add_ci.tbl_svysummary() dichotomous variables. add_ci.tbl_svysummary() now takes properly account percent argument (#1470)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-170","dir":"Changelog","previous_headings":"","what":"gtsummary 1.7.0","title":"gtsummary 1.7.0","text":"CRAN release: 2023-01-13","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-7-0","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.7.0","text":"Updated default argument values tidy_robust(vcov=NULL, vcov_args=NULL). Users must specify type robust standard errors using arguments. Fully removed deprecated items originally deprecated v1.2.5 (released 3 years ago). add_p(exclude=), as_gt(exclude=), as_kable(exclude=), as_tibble.gtsummary(exclude=), tbl_regression(exclude=), tbl_uvregression(exclude=) tbl_summary_(),add_p_() add_global_p(terms=)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-7-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.7.0","text":"New function add_ci.tbl_svysummary() adding confidence intervals tbl_svysummary() summary statistics. (#965)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-7-0","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.7.0","text":"Arguments pass via dots tbl_uvregression(...) now passed broom.helpers::tidy_plus_plus(...). (#1396) Added new theme elements control default headers tbl_summary(). (#1401) examples previously used
line breaks gt tables updated use \\n. Additionally, \"qjecon\" journal theme updated use updated line breaker well. (#1311) Now allowing mixed-class numeric types tbl_summary(), inline_text() throw error pattern argument specified. Added stats::mood.test() add_p.tbl_summary(). (#1397)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-documentation-1-7-0","dir":"Changelog","previous_headings":"","what":"New Documentation","title":"gtsummary 1.7.0","text":"Added new article illustrating place gtsummary tables Shiny applications. (#1335)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-7-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.7.0","text":"Updated Lancet journal theme report p-values precision, per journal’s reporting guidelines. (#1442) Fix as_flex_table() header blank. (#1406) Fix tbl_summary() now allows column vectors named within data frame. (#1403)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-163","dir":"Changelog","previous_headings":"","what":"gtsummary 1.6.3","title":"gtsummary 1.6.3","text":"CRAN release: 2022-12-06 as_flex_table() function now recognizes markdown bold (**) italic (_) syntax headers spanning headers. Restrictions apply. See help file details. Users can longer place sets double stars underscores without text formatted markdown syntax. (#1361) modify_caption() function now works tables created gtreg::tbl_listing() contain column named \"label\". (#1358) Functions tbl_summary() tbl_svysummary() now support \"{n}\", \"{p}\", \"{level}\" = variable present use functions like modify_header(). example, following previously invalid code works well overall column stratified columns: survey summary, unweighted variants also available. (#1366) Added experimental feature additional arguments can passed broom.helpers::tidy_plus_plus() via tbl_regression(...). (#1383) Updated arguments tidy_robust() account updates {parameters}. (#1376) Allowing ‘survfit’ objects class survfit2 add_nevent.tbl_survfit(). (#1389) Added oneway.test() test add_p(). (#1382) Now using {ggstats} plot regression model coefficients via plot() instead {GGally}. (#1367) Bug fix tbl_custom_summary(): full dataset (including missing observations) now properly passed full_data (#1388)","code":"trial %>% tbl_summary(by = trt) %>% add_overall() %>% modify_header(all_stat_cols() ~ \"**{level}**, N = {n}\")"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-162","dir":"Changelog","previous_headings":"","what":"gtsummary 1.6.2","title":"gtsummary 1.6.2","text":"CRAN release: 2022-09-30 following updates made indentation implementation gt output: Previously, HTML output able indent gt tables, implemented via gt::tab_style(). Indentation now available HTML, PDF, Word implemented adding unicode non-breaking spaces data frame via gt::text_transform(). “names” indentation calls updated \"indent\" \"indent2\". change affect users. ’re sure names refer , affect . Indentation RTF currently work. Instead indented columns, irregular unicode characters shown. issue addressed future gt release. use RTF output, like output identical update, use as_gt(include = -indent). link cheat sheet added website’s navigation bar. Added additional options remove_row_type(type = c(\"level\", \"\")). Use type = \"\" remove rows associated variable(s) specified remove_row_type(variables=). Use type = \"level\" conjunction new argument level_values= remove specified levels variable, use new argument remove levels categorical variables. Added standard error means list available statistics continuous data summaries tbl_svysummary(). (#1291) Added Dutch language translations. (#1302) Updated add_significance_stars() accept gtsummary table (instead regression model summaries) work add_global_p() (#1320) Added \"var_type\" hidden column output tbl_survfit(). addition ensures table work remove_row_type(). (#1343) Updated calls round() style_*() functions round2(), implements classic rounding rules. (#1304) Fixed bug style_sigfig() numbers close thresholds. (#1298) Fixed bug column named \"variable\" passed tbl_custom_summary(=), resulted error. (#1285) Bug fix as_tibble(fmt_missing = TRUE). Previously, missing assignments applied one row ignored. (#1327) Bug fix column alignment tbl_stack() as_kable_extra() output. (#1326)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-161","dir":"Changelog","previous_headings":"","what":"gtsummary 1.6.1","title":"gtsummary 1.6.1","text":"CRAN release: 2022-06-22","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-6-1","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.6.1","text":"Added standard error proportions list available statistics categorical data summaries tbl_svysummary(). (#1187) Added Tarone-Ware test add_p.tbl_survfit() (#732) Updated add_global_p() handle tbl_uvregression() objects users specified x= argument (y= argument common). (#1260)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-6-1","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.6.1","text":"Updated start-messaging. (#1228) paired.wilcox.test available add_p.tbl_summary() add_difference.tbl_summary() mistakenly marked returning difference, . documentation corrected, results improved messaging user test selected add_difference(). (#1279) Improved error messages paired tests add_p() add_difference() group= argument specified. (#1273) Added argument with_gtsummary_theme(msg_ignored_elements=) argument. Use argument message users theme elements overwritten therefore ignored inside with_gtsummary_theme() call. (#1266) Swapped gt::fmt_missing() gt::sub_missing() former now deprecated. (#1257) checks \"haven_labelled\" class now performed variables indicated include= = tbl_summary() tbl_svysummary(). checks tbl_uvregression() tbl_survfit.data.frame() applied variables include=, e.g. checking outcome variable(s). Updates labels default formatting functions unweighted statistics presented tbl_svysummary(). (#1253) Adding additional structural checks tbl_merge() inline_text() provide better error messaging. (#1248) Added tbl_regression.crr() method messaging recommending use tidycmprsk::crr() instead. (#1237) experimental support ftExtra::colformat_md() as_flex_table() removed. function requires evaluated YAML paths allow un-evaluated references like bibliography:: \"`r ::()`\". (#1229) Update tbl_summary(=) now allows column named \"variable\" passed. (#1234) Added theme element control missing statistic shown summary tables options display number percent missing non-missing total number observations. (#1224) Renamed modify_cols_merge() modify_column_merge() inline modify_column_*() functions.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-6-1","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.6.1","text":"Fix as_kable_extra() output format 'latex' cell bold italicized special characters double-escaped. Added condition escape special characters styled cells. (#1230) Fix with_gtsummary_theme(). function restored previously set theme, inadvertently included temporary theme along .","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-160","dir":"Changelog","previous_headings":"","what":"gtsummary 1.6.0","title":"gtsummary 1.6.0","text":"CRAN release: 2022-04-25","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"improvements-to-as_kable_extra-1-6-0","dir":"Changelog","previous_headings":"","what":"Improvements to as_kable_extra()","title":"gtsummary 1.6.0","text":"users used default kableExtra print without output-specific formatting, breaking changes…changes improved output styling. Markdown bold, italic, underline syntax headers, spanning headers, caption, footnote converted escaped LaTeX code. Special LaTeX characters body table escaped .escape_latex() .escape_latex2(), e.g. % updated \\\\%, rendered % PDF document. “” symbol recognized line break table headers, spanning headers, caption, table body. \\n removed footnotes escape= argument now passed kableExtra::add_header_row() kableExtra::footnote() well (previously, passed knitr::kable()). as_kable_extra(escape=, format=) arguments made explicit, previously, arguments passed via .... Breaking Change default value escape= now FALSE. users previously used as_kable_extra(escape=FALSE) manually escaped LaTeX/HTML characters body table, characters now double escaped. print table without auto-escaping now present, utilize new argument as_kable_extra(addtl_fmt=FALSE) Breaking Change fmt_missing= argument added as_tibble(), as_kable(), as_kable_extra() last release. argument now deprecated as_kable() as_kable_extra(). user want missing values formatted, can exclude commands include= argument. Breaking Change strip_md_bold= deprecated. markdown syntax automatically stripped headers, unless escape = FALSE format = \"latex\". case, markdown syntax converted LaTeX commands. default markdown syntax headers spanning headers removed. Special characters table body, headers, spanning headers, caption, footnote escaped .escape_html(). \"\\n\" symbol removed footnotes","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"improvements-to-as_flex_table-1-6-0","dir":"Changelog","previous_headings":"","what":"Improvements to as_flex_table()","title":"gtsummary 1.6.0","text":"Added support markdown syntax {flextable} header rows utilizing {ftExtra} package. package installed options(gtsummary.use_ftExtra = TRUE) set (equivalent theme element), bold/italic markdown syntax found headers styled. Otherwise, markdown syntax stripped header rows. (#1200)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-6-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.6.0","text":"New function as_hux_xlsx() added export formatted {gtsummary} table directly Excel. Added tbl_regression.tidycrr() method summarize competing risks regression models. (#1169) Added tidier tidy_wald_test(), generic function can calculate Wald test statistics groups variables model. tidier expects model object supported vcov() coef() obtain variance-covariance matrix coef vector. Adding functions get_gtsummary_theme() with_gtsummary_theme() extracting current gtsummary theme running code temporarily theme. Added new function modify_column_indent()–wrapper modify_table_styling()–make easier add remove indentation table. Now exporting function primarily used internally helper converting gtsummary table gt (formats): .table_styling_expr_to_row_number(). Theme helper function check_gtsummary_theme() added. function takes gtsummary theme list input, runs various consistency checks. Useful constructing personalized theme. function replaces internal checks passed theme element indeed valid theme element.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-6-0","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.6.0","text":"Functions bold_labels(), bold_levels(), italicize_labels(), italicize_levels() now method functions can work better tbl_cross() objects. Total overhaul way statistics saved reported modify_header(), modify_spanning_header(), modify_footnote(), modify_caption(). now standardized place statistics saved gtsummary tables (x$table_styling$header columns starting \"modify_stat_\"). modify functions updated access statistics header data frame. added benefit structure, statistics available tables merged stacked. Statistics available modify_caption() taken \"label\" column. (#1165, #1101) Added add_global_p(anova_fun=) argument allowing users pass custom functions calculate global p-values car::Anova() support model type. (#1149) Functions bold_labels(), bold_levels(), italicize_labels(), italicize_levels() now bold/italicize first column shown table. Previously, \"label\" column (often first shown column) styled. Added theme element pass arguments knitr::kable() as_kable() as_kable_extra(). Updated default function add_glance_*(glance_fun=) MICE models. (#1137) Add tbl_butcher(keep=) argument optionally keep internal objects needed. (#1148) Adding Norwegian translations (#1143)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-6-0","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.6.0","text":"Removed use round() style_number(), replaced round function “round--even”. (#1140) Converted Table Gallery vignette FAQ+Gallery (#811) Added error messaging user tries run add_p() add_difference() twice. (#1209) models CIs labelled Confidence Interval. Now Bayesian models correctly label Credible Interval. (#1196) Improved error messaging functions as_gt(), as_kable(), as_flex_table(), as_hux_table() object class ‘gtsummary’ passed. (#1188) Deprecated as_huxtable(strip_md_bold=) {huxtable} now recognizes markdown syntax reason remove markdown syntax. Added huxtable::set_header_rows() as_hux_table() stack. Improved error messaging modify_*() functions. (#914) Added style_percent() default formatting function un-weighted proportions. (#1181) global options previously available now soft deprecated. documentation global options removed v1.3.1. (#1085) as_flextable() function upgraded soft hard deprecation; use as_flex_table() instead. longer removing survey design columns survey objects columns summarized tbl_svysummary() summarized tbl_uvregression(). users previously didn’t indicate variables summarize include=, design columns now appear summary tables. (#1166) Added check functions accept ... nothing passed .... bad misspelled argument found, users informed. (#1083)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-6-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.6.0","text":"Fix \"emmeans\" methods add_difference() due argument name change emmeans package. now require recent version package. (#1205) Bug fix inline_text.tbl_summary() one pass pattern column argument NULL. (#1193) Fix as_gt() hidden columns. Fix add_p.tbl_svysummary() Wald tests converted flextable. survey tidier saved column matrix-column instead vector, incompatible flextable output. (#1153) Fixing Lancet theme mid-point encoding issue Linux MacOS. (#1146) Fix using summary type gtsummary selectors (e.g. all_continuous()) add_ci(style_fun=) argument. (#1141)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-152","dir":"Changelog","previous_headings":"","what":"gtsummary 1.5.2","title":"gtsummary 1.5.2","text":"CRAN release: 2022-01-29 Removed foreign reference external functions top level package replaced indirect calls (reason short time releases). (#1129) Updates way footnotes printed tbl_summary() summary type \"continuous2\" present. Previously, footnotes removed, now \"continuous2\" footnotes removed. (#1127) Added continuous variable name/label footnote greater clarity tbl_continuous() (#1123) Now exporting .create_gtsummary_object() function utility packages build gtsummary tables. (#1130) Fix add_overall() run add_n(). overall row omitted sum Ns doubled. (#1126) Added method “emmeans” add_difference() tbl_svysummary() objects. Updated default add_difference() tbl_svysummary() objects “emmeans” continuous dichotomous variables, “smd” categorical variables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-151","dir":"Changelog","previous_headings":"","what":"gtsummary 1.5.1","title":"gtsummary 1.5.1","text":"CRAN release: 2022-01-20","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-5-1","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.5.1","text":"Added new function modify_column_alignment() updated column alignment. Function wrapper complex modify_table_styling() function. New function tbl_strata2() passes stratified data frame well stratum level user function. (#1091) Added add_p.tbl_continuous() method adding p-values tbl_continuous() tables. (#1023) Added add_overall.tbl_continuous() method. (#1037)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-5-1","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.5.1","text":"New test option “emmeans” add_difference() add_p() uses {emmeans} package estimate marginal means/least-squares means continuous variables, binary variables random intercept models. (#1112) Column alignment now recognized as_kable() as_kable_extra(). Previously, alignment utilized kable() defaults ignored alignment instructions included gtsummary table styling. as_kable_extra() updated utilize kableExtra::column_spec() kableExtra::cell_spec() apply bold italic styling. choice function depends use escape= knitr::kable() (#1107) Default arguments knitr::kable() may now overwritten passing ... either as_kable() as_kable_extra(). Previously, passing user-defined argument previously use result error. Added tbl_strata(.header=) argument providing greater control stratum headers added tables, e.g. can now add Ns headers using argument. Added add_p.tbl_cross(test.args=) argument. (#1095) tbl_strata(.combine_args=) added lets control arguments tbl_merge() tbl_stack() occurs tbl_strata(). (#1090) Added add_ci(pattern=) argument, makes easier merge CI column primary statistics column. (#1029) Suppress tbl_merge() spanning headers passing tbl_merge(tab_spanner = FALSE) (#1067) Functions as_tibble(), as_kable(), as_kable_extra() gain fmt_missing= argument applies missing symbols missing values. as_tibble() argument defaults FALSE, others’ default TRUE. (#1073) Adding tbl_regression(conf.int=) tbl_uvregression(conf.int=) argument. models, confidence interval adds computation time significantly may needed. argument omit CI calculation. (#1052) add_stat() function updated accept tbl_continuous() tables. Multinomial models computed using MICE now supported. (#1065) Added theme element control tbl_regression(conf.int=) default argument. now possible pass single tbl tbl_merge(). useful using tbl_merge() helper functions. (#1068) Added statistics= digits= arguments add_overall() family functions. (#1047) Added digits= argument tbl_cross(). (#1046)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-5-1","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.5.1","text":"Allowed modification font_size compact theme. (#1106) Automatically reduced vertical white space columns compact flextable theme. Improved user interface modify_*() functions (#1064) Improved error messaging throughout package. (#1050) Added link syntax help file functions throughout package. syntax help file illustrates use gtsummary selectors details formula-list notation. (#981) Updated Spanish translation Wilcoxon Rank-sum Test. Updates additions Portuguese language translations. (#1098) Updates French translations. Updating add_overall() S3 method common structure, e.g. add_overall(x, ....), previously, ... present. (#1066) Updated theme_gtsummary_journal(\"qjecon\") set tbl_regression(conf.int = FALSE) default. Improved error messaging tbl_custom_summary() Updated default formatting functions tbl_custom_summary(). Previously, summaries character results erred default summary function style_number(). updated style_sigfig() numeric columns, .character() everything else. (#983) style_*() functions retain attribute, names. (#1035, #1031, #981) add_n.tbl_regression() (also utilized tbl_uvregression()) adding N column without applying formatting function. style_number() function now added default styler. (#1022) Added class \"tbl_continuous\" output tbl_continuous(). Adding add_p() test \"mcnemar.test.wide\" calculate p-value data stored wide format, e.g. one column value second column . McNemar test variant available {gtsummary} expects data long format. Converted tbl_split() S3 function. Update calls gt::fmt_missing() constructed memory efficient.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-5-1","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.5.1","text":"Fix add_significance_stars() led error summarized model confidence interval column. Fix as_flex_table() as_hux_table() reference row properly placed tbl_merge() merged tables share common categorical variables different reference rows. (#1063) Fix inline_text.gtsummary() first level categorical variable selected table also processed remove_row_type(). (#1078) Fix modify_table_styling(cols_merge_pattern) used tbl_stack() followed tbl_merge(). (#1057) Bug fix separate_p_footnotes() test names translated theme_gtsummary_language() set. (#1055) Fix tbl_merge() rows merging table present first table. (#1033) Fix as_tibble() nnet::multinom() regression models. Fix tbl_continuous() include= specified. Fix tbl_regression() tidier returns CI columns missing. (#1012) Fix add_p()/add_difference() check whether passed test internal method custom method. previous code required Suggested packages, , {lme4}, {effectsize}, {survey}, installed. (#1018)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-5-1","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.5.1","text":"longer exporting assert_package(). migrated {broom.helpers} now use broom.helpers::.assert_package(). (#1051)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-150","dir":"Changelog","previous_headings":"","what":"gtsummary 1.5.0","title":"gtsummary 1.5.0","text":"CRAN release: 2021-10-16","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-5-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.5.0","text":"Added new function tbl_continuous() summarize continuous variable 1 categorical variables. Added new function add_ci() adds new column confidence interval proportions/means reported tbl_summary(). (#868) Migrated new function tbl_split() {bstfun} package. Function allows users split {gtsummary} table multiple tables. Migrated new function separate_p_footnotes() {bstfun} package. Function allows users separate composite footnote listing tests performed add_p(), replaces individual footnotes test name. New function tbl_custom_summary() allowing create table summary statistics using custom summary function (#973, #976) Set helpers used tbl_custom_summary(): continuous_summary(), proportion_summary(), ratio_summary() New function modify_cols_merge() can merge two columns {gtsummary} table. (#939) Added function tbl_butcher() reduce size {gtsummary} table. object butchered, {gtsummary} functions may able execute object. Added new function tidy_robust() add robust standard errors, confidence intervals, p-values tbl_regression() tbl_uvregression(). function wrapper parameters::model_paramters(). (#979)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-5-0","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.5.0","text":"Added CITATION file users can now cite R Journal manuscript using citation(\"gtsummary\"). Added Standardized Mean Difference method add_difference(), wrapping {smd} package’s calculations. (#966) Extended add_difference() accept tbl_svysummary() objects addition tbl_summary() objects. Added standardized mean difference method tbl_svysummary() tables. Added tbl_strata(.stack_group_header=) argument include/exclude headers tables combined tbl_stack() Added tbl_strata(.quiet=) argument. Allow add_p() add_difference() run table. (#959) Updated add_overall() include overall statistics df_stats tibbles saved .$meta_data. makes possible report overall statistics using inline_text(pattern=) argument.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-5-0","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.5.0","text":"Added help file detailing formula list notation used throughout {gtsummary} package. (#981) Updates tbl_regression() documentation. model N longer reported default, removed section help file. (#998) Updates make internal df_stats objects consistent across various {gtsummary} objects. Added internal function df_stats_to_table_body adds numeric df_stats tibble .$table_body. formatting functions also added new columns .$table_styling$fmt_fun. function now used inline_text.gtsummary() prepare returned statistics (#921) Now using broom::tidy() prepare car::Anova() results. stable version originally written. (#898) function assert_package() now takes minimum required version package DESCRIPTION file, function now exported. Now using broom::tidy() prepare aov() test results add_p.tbl_summary(), adds additional columns .$table_body() (#956) Updated README include links recording gtsummary presentation RStudio Education blog post. Removed maturing lifecycle tag README. Updated deprecated function workflows::pull_workflow_fit(x) workflows::extract_fit_parsnip(x).","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-5-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.5.0","text":"Fix tbl_summary() factor variable passed NA specified levels. (#977) Fix add_p.tbl_summary() factor variable NA values passed. (#977) Bug fix add_difference(estimate_fun=) argument.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-5-0","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.5.0","text":"Updated add_p.tbl_summary(test = . ~ \"mcnemar.test\", group = id) syntax require group= argument align paired Wilcoxon rank-sum test paired t-test syntax. Deleted deprecated functions add_comparison(), add_global(), tab_style_bold_p(), tab_style_bold_labels(), tab_style_italicize_levels(), tab_style_italicize_labels(), tab_style_bold_levels(). following deprecated arguments removed: tbl_summary(group=), as_gt(omit=). survival package moved Imports Suggests, longer automatically installed {gtsummary} installed. Additionally, survival::Surv() longer re-exported package.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-142","dir":"Changelog","previous_headings":"","what":"gtsummary 1.4.2","title":"gtsummary 1.4.2","text":"CRAN release: 2021-07-13 Update internals tbl_stack() better handle two stacked tables stacked (#906) Updates make tbl_svysummary() compatible {survey} package updates v4.1 (#930) as_hux_table() function previously stripped markdown old syntax column headers spanning headers. output now uses markdown syntax headers default utilizing huxtable::set_markdown() (#885) Variables passed tbl_svysummary(=) argument now automatically added include=. (#925) Bold italic requests now ignored kableExtra output. carried via markdown syntax, supported {kableExtra} (#917) Bug fix add_p.tbl_cross(pvalue_fun=); argument ignored. Updated style_pvalue() format p-values slightly larger 1 slightly lower 0 (due imprecise numeric storage). (#907) Fix allowing factor vectors passed tbl_stack(group_header=). (#908) Updated arguments y= x= tbl_uvregression() allow non-standard names (#912)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-141","dir":"Changelog","previous_headings":"","what":"gtsummary 1.4.1","title":"gtsummary 1.4.1","text":"CRAN release: 2021-05-19 Updated tbl_regression() compatible models created {parsnip} {workflows} packages (#890, #647) Added modify_table_styling(text_format = \"indent2\") option double indent row. (#864) Messaging update inline_text.gtsummary() suspects variable repeated gtsummary table. (#855) Bug fix add_p.tbl_summary() columns NA. variables longer error; rather, message printed indicating p-value possible calculate. (#889) Updated tbl_svysummary() compatible {srvyr} package (#886) Updated default header using tbl_uvregression(x=) \"**Outcome**\" (#867) tbl_summary(=) variable now added include= default (#871) Variables converted numeric passed wilcox.test() add_p(). avoids error date difference passed. (#880) Bug fix {Hmisc} labeled data tbl_summary() (#876) Bug fix add_n.tbl_summary() proportion missing cases. (#903) Updates default formatting functions add_glance_*() functions. P-values now styled style_pvalue() . Obs. degrees freedom style_number() (#870)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-140","dir":"Changelog","previous_headings":"","what":"gtsummary 1.4.0","title":"gtsummary 1.4.0","text":"CRAN release: 2021-04-13","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-4-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.4.0","text":"Added new function add_glance_table() companion add_glance_source_note(). Function adds model statistics, R-squared, bottom model summary table. Added new function add_significance_stars() adding star indicators significant estimates explanatory footnote. Added new function tbl_strata(). function aids prepares gtsummary tables stratified one variables (#679) Adding coefficient plot() methods tbl_regression() tbl_uvregression(). Function creates forest plot model coefficients via GGally::ggcoef_plot(). New function modify_fmt_fun() introduced help update functions format numeric columns rows .x$table_body. New function introduced, modify_table_styling(), update printing instructions tables. function replaces modify_table_header(), now soft deprecated. Added function add_vif() include variance inflation factors tbl_regression() output. (#717) Added generic function inline_text.gtsummary() can report results gtsummary table. (#398)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-4-0","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.4.0","text":"Print infrastructure updated allow row column specification formatting data table styling. x$table_header object replaced general x$table_styling. Review updated vignette \"gtsummary_definition.Rmd\" details. x$table_body longer grouped tbl_stack(); rather, grouping variable specified gt::gt(groupname_col=) tbl_summary() now accepts class input. Previously non-date base classes accepted. non-base R classes, summary type must specified using tbl_summary(type=). default summary statistic dates/times minimum maximum. (#488) add_stat() function may now return multiple columns new statistics. arguments deprecated update. (#746) tbl_uvregression() now accepts data frames survey design objects input. (#742) default tidy_fun = broom::tidy fails, parameters::model_parameters() attempts tidy model, {parameters} installed. (#854) Added custom tidier mgcv::gam() models (tidy_gam()) method function (tbl_regression.gam()) uses new tidier default. (#745) Added default support brmsfit model tbl_regression() new method function. (#751) Functions modify_footnote() modify_spanning_header() now include text_interpret= argument indicating whether use gt::md() gt::html() format text. Default gt::md(). Added/updated functions add_n() add_nevent() work tbl_regression tbl_uvregression objects. function now argument place Ns label level rows. (#744) Added Quarterly Journal Economics theme_gtsummary_journal(). journal theme updated gt package updates cols_merge() rows argument allows line breaks within cell. Korean Icelandic language translations added theme_gtsummary_language(). Ability merge two columns modify_table_styling(cols_merge_pattern=) argument. Added theme element \"pkgwide-fun:pre_conversion\". function specified executed gtsummary object printed converted as_gt(), as_flex_table(), etc functions. (#773) modify_table_body(fun=) argument generalized accept formula shortcut notation. Added exploratory data analysis theme shows details default, theme_gtsummary_eda().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-4-0","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.4.0","text":"Updatedtbl_merge() tbl_stack() capture first source note caption merged/stacked tables. Previously, captions source notes lost. Added messaging table caption requested via modify_caption() gt table using version gt support captions. Updates table gallery vignette reflecting changes package. (#775) Improved error messaging problem constructing one univariate regression models tbl_uvregression(). Added variable-specific formatting add_difference(estimate_fun=) allowing single table show, example, mean rate differences formatted/rounded differently. Improved handling messaging users columns \"haven_labelled\" class passed gtsummary functions. (#805) Improved handling ordered factors = variable (#569, #540) Removed {usethis} package dependency replaced {cli}. (#768) Added survey-adapted t-test theme_gtsummary_mean_sd() continuous variables add_p.tbl_svysummary() (#758) Allowing tidyverse shortcut notation tbl_survfit(estimate_fun=) specification, e.g. tbl_survfit(estimate_fun= ~style_sigfig(.x * 100)) (#761) JAMA journal theme updated merge coefficient confidence interval columns. Updated inline_text() functions wrap inline_text.gtsummary()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-4-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.4.0","text":"label= argument unstratified models ignored tbl_survfit() (#842) Preserve ordering factor variables tbl_survfit(). (#764) Bug fix spanning headers kableExtra output. spanning header misplaced header text sandwiched two blank spanning headers. Bug fix displaying unobserved level factor variable dichotomously tbl_summary(). (#780) Bug fix add_p() test name footnote translated theme_gtsummary_language().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-4-0","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.4.0","text":"tbl_survival() moved questioning deprecated. function maintains old x$table_header format (instead flexible x$table_styling). \"level_label\" column renamed \"groupname_col\" x$table_body longer grouped group_by(level_label) back-end implementation add_stat_label(location = \"row\") updated. function now merges columns \"label\" \"stat_label\" instead modifying \"label\" column directly. breaking change users manually updated results, example, tbl_regression() table merge tbl_summary() using tbl_merge() function add_stat_label() longer auto-switches location = \"column\" requests \"row\" presence \"continuous2\" variables.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-137","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.7","title":"gtsummary 1.3.7","text":"CRAN release: 2021-02-26 changes. Resubmitting resolve CRAN quirk.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-136","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.6","title":"gtsummary 1.3.6","text":"CRAN release: 2021-01-08","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-3-6","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.3.6","text":"Added function add_difference(), adds difference groups, confidence interval p-value. (#617) Added function modify_caption() includes table captions. gt output, requires gt version > 0.2.2 (#701) Added function modify_table_body() allowing users easily make changes gtsummary tables Added function remove_row_type() removing header, reference, missing rows gtsummary tables. (#678) Added selecting function all_stat_cols() selects columns tbl_summary/tbl_svysummary object summary statistics (.e. \"stat_0\", \"stat_1\", \"stat_2\", etc.). New selecting function added all_tests() make easier select variables based test used calculate p-value, e.g. add_p(test = c(age, marker) ~ \"t.test\", test.args = all_tests(\"t.test\") ~ list(var.equal = TRUE)) Added functions modify_column_hide() modify_column_unhide() hide unhide columns .$table_body. Simple wrappers modify_table_header().","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-3-6","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.3.6","text":"Previously, tbl_summary(digits=) accepted integer values specifying number decimal places round statistic. argument now accepts integers functions, e.g. digits = age ~ style_sigfig. (#708) add_stat() function now supports tbl_svysummary() objects addition tbl_summary() (#688) add_stat() function can now place statistics label row, level rows categorical variables. (#714) inline_text.tbl_survfit() updated allow users select p-value () columns. (#589)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-3-6","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.3.6","text":"modify_header() updated users may easily access internal data defining headers longer adds call gtsummary .$call_list (#719) default value include= argument add_global_p.tbl_regression() add_global_p.tbl_uvregression() methods made include = everything(), help files methods brought together single file. (#721) Introducing new package dependency {broom.helpers} tidying preparation tbl_regression() tables now performed {broom.helpers} (#636, #607) select helper functions utility functions make possible, cleaned migrated {broom.helpers}. (#648, #680) Importing .generic_selector(), .select_to_varnames(), .formula_list_to_named_list() {broom.helpers}: function makes easy create selecting functions like all_continuous(). internals allow used {broom.helpers} {gtsummary} seamlessly. (#680) Theme element added controlling tidy_plus_plus() arguments. (#692) Variables follow standard naming conventions now parsed correctly presented regression tables. tbl_regression() function now S3 method. new interface allows special handling different model types using S3 methods: tbl_regression.default(), tbl_regression.lmer(), tbl_regression.glmer(), tbl_regression.survreg() tbl_regression(add_estimate_to_reference_rows=) argument added. Also added tbl_uvregression(). (#692) Theme element tbl_regression(add_estimate_to_reference_rows=) added. (#677) Removed \"Statistics presented:\" \"Statistical tests performed:\" prefixes tbl_summary() %>% add_p() footnotes. codebase powering add_p() related methods refactored better performance, organization, customizability. (#622) clarity, help file listing test available within gtsummary pseudo code calculating p-value added (see ?tests) add_p() method now test.args= argument. Use argument pass additional arguments statistical method, e.g. add_p(test = c(age, marker) ~ \"t.test\", test.args = c(age, marker) ~ list(var.equal = TRUE)) Additional tests added: paired t-test, signed rank test, . See ?tests full list. robust unit testing implemented add_p() methods. Added messaging tbl_stack() inform users attributes first table passed take precedent others’. (#699) modfiy_*() functions, users select columns, encountered error. Now, columns selected, instructions printed correctly select columns gtsummary table. Moreover, columns selected, gtsummary object now returned unaltered. (#699) add_glance_source_note() function generalized users may pass glance function. Previously, broom::glance() used option change . (#699) ... arguments added as_gt(). dots subsequently passed gt::gt(...). (#701) Multiple imputation models created {mice}, multinomial regression models created {nnet} now supported tbl_regression() (#645) Updates add_global_p.tbl_regression() allowing variable names spaces special characters (#682) Added digits= argument style_percent() (#690) Users may now choose tbl_regression() columns report theme element. can choose among \"estimate\", \"std.error\", \"statistic\", \"ci\", \"conf.low\", \"conf.high\" \"p.value\" (#637) Allow users include reference value tbl_regression() via theme element Users may change symbol reference row symbol theme element. (#628)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-6","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.6","text":"Bug fix default statistic set using themes \"continuous2\" variables length larger one Bug fix missing/non-missing percentages requested add_n.tbl_summary()","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-3-6","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.3.6","text":"default test 2--2 tables expected cell counts updated chi-squared test continuity correction original chi-squared test add_p.tbl_summary() (#721) Experimental function add_p.tbl_survfit(test.args=) addition accepting formula list notation, also accepted single string naming test interpreted everything() ~ \"test_name\". single string longer accepted, users must use formula notation. Removed theme element N_fun previously marked questioning likely removed package.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-135","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.5","title":"gtsummary 1.3.5","text":"CRAN release: 2020-09-29","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functionality-1-3-5","dir":"Changelog","previous_headings":"","what":"New Functionality","title":"gtsummary 1.3.5","text":"New summary type continuous2 allows adding labelled statistic rows tables tbl_summary() tbl_svysummary(). can report several lines statistics type. (#620) all_continuous() function now selects summary types continuous continuous2 default. Added all_continuous2() function selecting summary type continuous2 exclusively. Added theme_gtsummary_continuous2() make continuous2 default summary type continuous variables. New function add_glance_source_note() adds statistics returned broom::glance() source note tbl_regression() (#434) Exporting modify_table_header() function, advanced-use function used make modifications .$table_header object update printing instructions gtsummary object. Added two custom tidiers use tbl_regression() tbl_uvregression(). (#635) tidy_standardize() returns standardized coefficients using {effectsize} package tidy_bootstrap() gives bootstrapped parameter estimates, calculated using {parameters} package","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-5","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.5","text":"Bug fix estimate_fun= pvalue_fun= passed tbl_regression() tbl_uvregression() environments bug evaluating LHS formula inputs. complex situations, stored character vector column names properly evaluate (#604) Fixed style_ratio() bug rounding errors near one (#651) Fixed style_sigfig() bug rounding errors near thresholds (#638) Adding footnote stat columns describing statistics presented overall column (#643)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-3-5","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.3.5","text":"Refresh vignettes use recently released functions (#649) Moved nevent column N column add_nevent() called tbl_regression() object (#439) gtsummary themes updates Add theme_gtsummary_mean_sd() theme report mean SD default use t-tests ANOVA add_p() (#654) Added first draft NEJM theme Added mid-point decimal separator Lancet theme","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-134","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.4","title":"gtsummary 1.3.4","text":"CRAN release: 2020-08-27 Added copy tidyselect’s () function allow users use predicate select helpers (#632) Fixed tbl_cross() bug function defaulted 'column' margin = NULL. Now defaults display margins NULL. (#624) Changed default tbl_survfit() missing argument '\\U2014' (em dash) NULL (CRAN issue). Em dash still displayed default tables set later function.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-133","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.3","title":"gtsummary 1.3.3","text":"CRAN release: 2020-08-11","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-3-3","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.3.3","text":"{flextable} graduated Experimental status! Introducing as_flex_table(), replaces as_flextable(). updated function includes improvements default aesthetics tables, improved consistency spanning header rows. Added tbl_svysummary() function summarize complex weighted survey designs. tbl_svysummary now class works add_n(), add_p(), add_q(), add_stat_label(), add_overall(), inline_text(), tbl_merge() tbl_stack() (#460). family tbl_survfit() functions greatly expanded! tbl_survfit.survfit(), tbl_survfit.list(), tbl_survfit.data.frame() added accept single survfit object, list survfit objects, data frame flexible creation univariate survival tables. add_p.tbl_survfit(), add_n.tbl_survfit(), add_nevent.tbl_survfit() added include additional information tbl_survfit() tables. Adding as_hux_table() huxtable 5.0.0 release. Added show_header_names() function assist updating table headers, footnotes, spanning headers. function prints current underlying column names along labels easing process identifying column names needed make updates. (#539) Added language theme, theme_gtsummary_language() translating tables Spanish, French, Portuguese, German, Chinese (Traditional Simplified), Hindi, Marathi, Gujarati, Japanese Swedish (#511) Added style_number() function allows granular control numbers formatted throughout package. style_percent(), style_pvalue(), style_sigfig(), style_ratio() functions updated use style_number() background. implication users can now control every number gtsummary table appears. example, formatting can updated use comma decimal mark also specify big mark using gtsummary themes. (#458)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"user-facing-updates-1-3-3","dir":"Changelog","previous_headings":"","what":"User-facing Updates","title":"gtsummary 1.3.3","text":"Added support competing risk cumulative incidence estimates tbl_survfit() (#64, #448) Updated API set_gtsummary_theme(). Users longer need call set_gtsummary_theme(theme_gtsummary_journal()); rather, call theme_gtsummary_journal(). built-theme now argument set_theme = TRUE. FALSE, theme function invisibly return named list theme elements, theme set. (#522) Users can now specify many decimal places round statistics categorical variables tbl_summary(), e.g. 45 / 100 (45.0%). (#458) Added ‘Lancet’ theme theme_gtsummary_journal() Updated handling arguments accept functions allow users pass anonymous functions using tidyverse shortcut notation, e.g. ~style_pvalue(.x, digits = 2). header tbl_stack(group_header=) column now integrated typical gtsummary framework, meaning standard functions can executed , e.g. modify_header() non-gt output. Added type= argument add_global_p(), added include= keep= arguments add_global_p.tbl_uvregression() (#554)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"internal-updates-1-3-3","dir":"Changelog","previous_headings":"","what":"Internal Updates","title":"gtsummary 1.3.3","text":"Updated add_n() internals efficient without recalculating statistics previously saved tbl_summary() {survival} package moved Imports Suggests add_overall() function now method function, add_overall.tbl_summary add_overall.tbl_svysummary added (#460). Updated variable labels age marker trial dataset. Removed large *.gif files package reduce build size (#485)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-3","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.3","text":"Fixed bug source note made smaller font size compact theme table printed {flextable} (#584) Bug fix tbl_summary() data frame contained ordered factor column (#567) Bug fix categorical summary statistics requested continuous variables tbl_summary() tbl_svysummary() (#528) Bug fix named list {gtsummary} objects passed tbl_merge(x=) (#541) Bug fix tbl_uvregression() adjustment variables included formula = \"{y} ~ {x} + age\". adjustment variables printed resulting table. (#555)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-3-3","dir":"Changelog","previous_headings":"","what":"Breaking Changes","title":"gtsummary 1.3.3","text":"lifecycle::deprecate_warn() upgraded lifecycle::deprecate_stop() <= v1.2.0 (released Aug 2019) Removing as_flextable() replacing as_flex_table() due name conflict flextable::as_flextable (#462)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-132","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.2","title":"gtsummary 1.3.2","text":"CRAN release: 2020-06-14 Now returning columns broom::tidy() .$table_body() (#516) tbl_stack() now accepts named list gtsummary tables using group_header= argument (#524) add_p.tbl_summary() bug fix Wilcoxon rank-sum p-value calculation introduced last release (#525) Delaying release as_huxtable() next {huxtable} release.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-131","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.1","title":"gtsummary 1.3.1","text":"CRAN release: 2020-06-02","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-3-1","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.3.1","text":"Introducing themes {gtsummary}. Use function set_gtsummary_theme() set new themes, review themes vignette details setting creating personalized themes. (#424) New functions modify_footnote() modify_spanning_header() give users control table footnotes spanning headers. (#464) Introducing as_huxtable()! function converts gtsummary objects {huxtable} objects. {huxtable} supports indentation, footnotes, spanning headers Word, HTML, PDF output. (#469) New function add_stat()! Add new column statistic tbl_summary() table (#495)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"user-facing-updates-1-3-1","dir":"Changelog","previous_headings":"","what":"User-facing Updates","title":"gtsummary 1.3.1","text":"following columns tbl_summary() now available print continuous categorical variables: total number observations {N_obs}, number missing observations {N_miss}, number non-missing observations {N_nomiss}, proportion missing observations {p_miss}, proportion non-missing observations {p_nomiss}. (#473) Improved appearance default as_flextable() output (#499) Added tbl_cross(margin=) argument control margins shown output table. (#444) missing values now included calculation p-values tbl_cross(). Messaging statistical methods used added add_global_p(), add_q(), combine_terms(). (#471) Added include= argument tbl_summary(). preferred syntax p-values correlated data now tbl_summary(..., include = -group_var) %>% add_p(group = group_var). group variable now longer removed table summary. (#477) add_stat_label() function updated location= label= arguments change location statistic labels modify text labels. location = \"row\" now default. (#467) tbl_stack() function added group_header= argument groups stacked tables adds horizontal header row . (#468) Updated handling interaction terms tbl_regression(). Interaction terms may now specified show_single_row= label= arguments. (#451, #452)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"internal-updates-1-3-1","dir":"Changelog","previous_headings":"","what":"Internal Updates","title":"gtsummary 1.3.1","text":"Improved error messaging invalid statistics requested tbl_summary(statistic=) (#502) columns as_tibble() now styled converted character. Previously, styling applied columns, relied default printing type underlying data. ok rely default behavior as_kable(), introduction as_flextable() needed style format column character. Potential break code edge cases. (#493) Handling passed custom p-value functions add_p.tbl_summary() improved careful handling environments functions passed. related updates also made: Users may pass custom p-value function quoted string bare. basic functions calculating p-values, t.test() can now passed directly e.g. test = age ~ t.test. now perform check match check functions passed. passed, replace internal version returns p-value assigns test name. user passes custom function, ’s proper form (.e. named list return object) function returns single numeric value, assume p-value ’s added gtsummary table. Updated gtsummary core script, utils-gtsummary_core.R, refer non-base R functions pkg:: prefix, packages copy file don’t need import functions {gtsummary} NAMESPACE. Now just need depend packages. (#454)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-1","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.1","text":"Bug fix inline_text.tbl_summary() categorical variable contained levels empty strings. still issue user tries select empty string, however. Fixed bug variables tbl_cross() defaulted dichotomous instead showing categorical (#506) Bug fix using tbl_summary(=) missing observations = followed add_overall() Bug fix values \">0.9\" incorrectly made bold using bold_p(). (#489) Bug fix as_flextable(). (#482) Added formatting function numeric columns force conversion character. Spanning headers printed alphabetical order! Update preserve ordering.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-130","dir":"Changelog","previous_headings":"","what":"gtsummary 1.3.0","title":"gtsummary 1.3.0","text":"CRAN release: 2020-04-17","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-3-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.3.0","text":"Introducing tbl_cross(), add_p.tbl_cross(), inline_text.tbl_cross()! Easily construct cross tabulations two variables. Introducing tbl_survfit() inline_text.tbl_survfit()! eventually replace tbl_survival(), longer encouraged. new functions follow structural guidelines {gtsummary} object can merged stacked {gtsummary} object (#280) Introducing as_flextable()! function converts gtsummary objects {flextable} objects. {flextable} great option using R markdown Microsoft Word output. {flextable} supports indentation, footnotes, spanning headers Word, HTML, PDF output. Introducing as_kable_extra()! function converts gtsummary objects {kableExtra} objects. {kableExtra} supports indentation, footnotes, spanning headers HTML PDF output. (#394)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"user-facing-updates-1-3-0","dir":"Changelog","previous_headings":"","what":"User-facing Updates","title":"gtsummary 1.3.0","text":"Updated default print engine {gtsummary} objects. {gt} default printer R console R markdown documents HTML output. PDF, RTF, Word output default using {kable} note referring users new vignette explaining {gt} used. (#395, #396) Updated add_p() custom p-value description require double escape characters quotation marks (#361) Created structure enumerated list unit tests vetted model must pass, added tests (#383)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"internal-updates-1-3-0","dir":"Changelog","previous_headings":"","what":"Internal Updates","title":"gtsummary 1.3.0","text":"gtsummary object associated .$table_header. code needed print table either gt kable previously mix information stored table_header, code manually added gt_calls kable_calls object. Now, information needed print table stored table_header. advantage updates printing now require update table_header , longer need update tibble, kable gt calls. (#412, #414) {gt} package now released CRAN, ’ve updated depend CRAN version instead version GitHub. also resulted significant updates throughout documentation code. example, longer provide instructions installing {gt}, include internal checks {gt} installed. (#420) Several functions made general, may now applied {gtsummary}-like object. Functions updated add_q(), bold_p(), sort_p(), tbl_merge(), tbl_stack(), bold_labels(), bold_levels(), italicize_labels(), italicize_levels(). (#434, #429, #373) tbl_regression() previously printed estimate, confidence interval, p-value models. models don’t associated methods calculating p-value confidence intervals. update, now print p-value tidy() returns \"p.value\" column. Similarly, confidence interval printed tidy() returns \"conf.low\" \"conf.high\" columns. (#391, #404)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"bug-fixes-1-3-0","dir":"Changelog","previous_headings":"","what":"Bug Fixes","title":"gtsummary 1.3.0","text":"Bug fix data frame passed tbl_summary() single column (#389) tbl_summary() passing ordered factor = argument longer causes error. (#453)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-126","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.6","title":"gtsummary 1.2.6","text":"CRAN release: 2020-02-13 Bug fix random effects regression model coefficients exponentiated requested. Using broom.mixed::tidy() rather broom::tidy() resolved issue.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-125","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.5","title":"gtsummary 1.2.5","text":"CRAN release: 2020-02-11","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"documentation-1-2-5","dir":"Changelog","previous_headings":"","what":"Documentation","title":"gtsummary 1.2.5","text":"Updated documentation README improve readability, added cross-linking across pages, added search terms help users find package, added gif demonstrations (#340) README images now build differently website vs GitHub markdown accommodate different output formats","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"breaking-changes-1-2-5","dir":"Changelog","previous_headings":"","what":"Breaking changes","title":"gtsummary 1.2.5","text":"Removed deprecated fmt*_() cols_label_summary() functions (#365) Functions tbl_summary_() add_p_() deprecated = group= arguments now accept strings (#250)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"syntax-1-2-5","dir":"Changelog","previous_headings":"","what":"Syntax","title":"gtsummary 1.2.5","text":"Package-wide update allowing arguments accept variable names accept bare/symbol inputs, character inputs, stored character inputs, tidyselect helpers. passing single variable, vars() function wrapper longer required. (#250) Updated tbl_uvregression() allow flexible tidyselect inputs improved error messaging arguments x y (#249) input updates #250, exclude= argument appearing add_p(), tbl_regression(), tbl_uvregression(), as_gt(), as_kable(), as_tibble() redundant. exclude= argument now deprecated. Use include= instead, tidyselect syntax. (#331) Functions all_categorical(), all_dichotomous(), all_continuous() may now used tbl_summary() argument type= (#256)","code":"tbl_summary(trial, label = age ~ \"NEW LABEL\")) tbl_summary(trial, label = \"age\" ~ \"NEW LABEL\")) tbl_summary(trial, label = c(\"age\", \"trt\") ~ \"NEW LABEL\")) tbl_summary(trial, label = c(age, trt) ~ \"NEW LABEL\")) tbl_summary(trial, label = vars(age, trt) ~ \"NEW LABEL\")) tbl_summary(trial, label = vars(everything(), -age, -trt) ~ \"NEW LABEL\")) age_column = \"age\" tbl_summary(trial, label = age_column ~ \"NEW LABEL\")) tbl_summary(trial, label = vars(age_column) ~ \"NEW LABEL\") purrr::map(c(\"trt\", \"grade\"), ~tbl_summary(trial, by = .x))"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"user-facing-improvements-1-2-5","dir":"Changelog","previous_headings":"","what":"User-facing improvements","title":"gtsummary 1.2.5","text":"New pattern= argument inline_text.tbl_summary(). Previously, grab entire cell tbl_summary() inline_text(), now can get single statistic reported (#254) Improved messaging users use knitr::kable() print gtsummary tables, users yet installed {gt} package (#347) New function combine_terms() allows users combine multiple independent variables regression model single line tbl_regression(). single line report regression coefficients, rather single p-value anova() function. (#310) regression modeling functions tbl_regression() tbl_uvregression(), users presented informative error message tidier fails (e.g. broom::tidy()) alerting location error may address issue (#337, #338) release gtsummary, now can make reference version gt release coincides . commit SHA gt now saved object called gt_sha, version gt can installed remotes::install_github(\"rstudio/gt\", ref = gt_sha) (#329) Created “style” family functions Improved error messaging tidyselect_to_list() (#300)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-features-and-fixes-1-2-5","dir":"Changelog","previous_headings":"","what":"Other features and fixes","title":"gtsummary 1.2.5","text":"Updated class detection use inherits(), added secondary class \"gtsummary\" objects. allows users create cobbled/custom gtsummary objects utilizing gtsummary print functions (#249) tbl_summary() now summarize columns class difftime (#343) Infrastructure update way styling/formatting functions returned. Styling functions now returned column .$table_header tibble. update simplifies handling styling functions tbl_merge() tbl_stack(). (#298, #299) Bug fix tbl_summary() variables NA (#344) data summary function add_p() now uses probabilities rather counts calculate expected cell counts avoid error working large data sets. (#341) Cubic spline terms now accurately matched variable name/term (#312) Bug fix non-standard evaluation arguments passed method.args= argument tbl_uvregression() (#322) Updates gt package deprecated gt::cells_data() favor gt::cells_body(). Check added as_gt() ensuring version gt gt::cells_body() NAMESPACE Lowered minimum required version R v3.4 (#356) Removed {broom.mixed} dependency {broom} package contained necessary tidiers (#354)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-124","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.4","title":"gtsummary 1.2.4","text":"CRAN release: 2019-12-16 Bug fix as_kable() column header match statistics presented certain levels = variable entirely missing tbl_summary() (#304) Updated trial example data set \"trt\" variable \"Drug \" \"Drug B\" instead \"Placebo\" \"Drug\" Improved messaging users error warning occurs calculating p-value add_p(). Also, p-values longer omitted output warning encountered calculation (#283) Added tidy_fun= argument tbl_regression() tbl_uvregression() allowing users pass tidiers {broom} {broom.mixed} packages (#247)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-123","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.3","title":"gtsummary 1.2.3","text":"CRAN release: 2019-11-12 tbl_uvregression() now accepts x= argument build univariate regression models covariate x remains models built remaining variables outcome (#294) Internal updates way {gt} installed CRAN checks. Bug fix stacking tbl_summary objects calculated p-values.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-122","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.2","title":"gtsummary 1.2.2","text":"CRAN release: 2019-11-10","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-features-1-2-2","dir":"Changelog","previous_headings":"","what":"New Features","title":"gtsummary 1.2.2","text":"tbl_summary objects may stacked merged tbl_stack() tbl_merge() (#230, #255) add_n() function now reports additional statistics: total N, non-missing N, missing N, percentages. missing = argument deprecated favor statistic = argument. (#237) Users may now pass list formulas, named lists, combination (#251) Users can add option script append {gt} calls {gtsummary} object printed: gtsummary.as_gt.addl_cmds Added include = exclude = arguments tbl_uvregression() (#240) Added standard evaluation variants, tbl_summary_() add_p_() (#223) Added as_tibble() function converts {gtsummary} table tibble (#245) New show_single_row argument tbl_regression() tbl_uvregression() allows binary variable printed single row. Previous argument show_yesno now deprecated. (#220)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"documentation-1-2-2","dir":"Changelog","previous_headings":"","what":"Documentation","title":"gtsummary 1.2.2","text":"Added gallery tables possible merging, stacking, modifying {gtsummary} arguments (#258) Added vignette documenting global option can set {gtsummary} (#289) Added {lifecycle} badges mark deprecated experimental functions (#225)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"other-updates-1-2-2","dir":"Changelog","previous_headings":"","what":"Other Updates","title":"gtsummary 1.2.2","text":"= column tbl_summary() now missing variables dropped rather halting error (#279) Bug fix vars() selection first variable listed selected (#259) Bug fix logical variable labels printed NA tbl_regression() (#248) tbl_merge() now interprets tab_spanner = text gt::md() (#253) longer checking outcome variable name consistency tbl_regression()—checking independent variable names (#287) Improved error messaging add_global_p() (#243) Removed gt::cols_merge() function ahead {gt} package PR 355 changes cols_merge() API (#222) Updated API using custom functions calculate p-values add_p(). User now may reference custom function name. (#226) Removed legacy support tidyr version less 1.0.0 (#235)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-121","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.1","title":"gtsummary 1.2.1","text":"CRAN release: 2019-08-20 Vignettes longer install {gt} package (required CRAN check) (#217) Added ability name custom add_p() tests (#213)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-120","dir":"Changelog","previous_headings":"","what":"gtsummary 1.2.0","title":"gtsummary 1.2.0","text":"CRAN release: 2019-08-19 Users can pass variable names backticks (#212) group = argument tbl_summary() moved add_p() (#208) Users can now write custom functions calculate p-values add_p() (#194) tbl_summary() = argument accepts bare variable name instead variable name passed string (#193) Added support column, row, cell percentages tbl_summary() (#181) Users can now set default p-value formatting functions, regression coefficient formatting functions, default level confidence intervals, formatting functions tbl_survival() (#120) {gt} package longer required dependency. {gt} installed, tables printed knitr::kable(). as_kable() function added package well. (#180) function as_gt() now include = exclude = arguments Updated function names first version Passing named lists tbl_summary() now defunct. tbl_stack() fix tbl_uvregression objects (#175) Option exclude variables testing using add_p() (#164) Updates {gt} package renamed cells_style() cell_text() (#78)","code":"bold_p() <- tab_style_bold_p() bold_labels() <- tab_style_bold_labels() bold_levels() <- tab_style_bold_levels() italicize_labels() <- tab_style_italicize_labels() italicize_levels() <- tab_style_italicize_levels()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-111","dir":"Changelog","previous_headings":"","what":"gtsummary 1.1.1","title":"gtsummary 1.1.1","text":"Modified tbl_merge() accommodate tbl_stack() object (#167) Bug fix incorrect column order tbl_summary() 10+ levels variable (#166)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-110","dir":"Changelog","previous_headings":"","what":"gtsummary 1.1.0","title":"gtsummary 1.1.0","text":"Added {tidyselect} {gtsummary} variable select functions (#146) Added tbl_stack() function (#152) Bug fix dichotomous yes/variables tbl_summary (#158) Changed add_comparison() add_global() add_p() add_global_p() (#143) Added sort_p() function (#105) Allow unobserved values serve level dichotomous variables (#149) Bug fix add_nevent() formula passed glm() string (#148) Added returned call_list functions without previously (#137) Corrected name call list returned tbl_regression() results (#128) tbl_survival(): bug fix upper bound CI able estimated (#134) tbl_survival(): groupname column name changed label_level (#133)","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-100","dir":"Changelog","previous_headings":"","what":"gtsummary 1.0.0","title":"gtsummary 1.0.0","text":"First release since major re-factoring. {gt} package now used print engine create tables. function names modified line {gt} function calls, additional functions added. API functions also updated. Review documentation vignettes details.","code":""},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"updated-function-names-1-0-0","dir":"Changelog","previous_headings":"","what":"Updated Function Names","title":"gtsummary 1.0.0","text":"","code":"tbl_summary() <- fmt_table1() tbl_regression() <- fmt_regression() tbl_uvregression() <- fmt_uni_regression() style_pvalue() <- fmt_pvalue() style_percent <- fmt_percent() style_ratio <- fmt_beta()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"new-functions-1-0-0","dir":"Changelog","previous_headings":"","what":"New Functions","title":"gtsummary 1.0.0","text":"","code":"tbl_survival() as_gt() tbl_merge() style_sigfig() add_nevent() gtsummary_logo()"},{"path":"https://www.danieldsjoberg.com/gtsummary/dev/news/index.html","id":"gtsummary-010","dir":"Changelog","previous_headings":"","what":"gtsummary 0.1.0","title":"gtsummary 0.1.0","text":"CRAN release: 2019-05-10 First version package available .","code":""}]