View source: R/tbl_demographics.R
tbl_demographics | R Documentation |
This is a thin wrapper of gtsummary::tbl_summary()
with the following differences:
Default summary type for continuous variables is 'continuous2'
.
Number of non-missing observations is added for each variable by default and placed on the row under the header.
The tbl_summary(missing*)
arguments have been renamed to
tbl_demographics(nonmissing*)
with updated default values.
The default footnotes from tbl_summary()
are removed.
tbl_demographics(
data,
by = NULL,
label = NULL,
statistic = list(all_continuous() ~ c("{mean} ({sd})", "{median}", "{min} - {max}"),
all_categorical() ~ "{n} ({p}%)"),
digits = NULL,
type = NULL,
value = NULL,
nonmissing = c("always", "ifany", "no"),
nonmissing_text = "n",
nonmissing_stat = "{N_nonmiss}",
sort = all_categorical(FALSE) ~ "alphanumeric",
percent = c("column", "row", "cell"),
include = everything()
)
data |
( |
by |
( |
label |
( |
statistic |
( |
digits |
( |
type |
( |
value |
( |
nonmissing , nonmissing_text , nonmissing_stat |
Arguments dictating how and if missing values are presented:
|
sort |
( |
percent |
( |
include |
( |
a 'gtsummary' table
# Example 1 ----------------------------------
gtsummary::trial |>
tbl_demographics(
by = trt,
include = c(age, grade)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.