tbl_ard_summary {gtsummary} | R Documentation |
ARD summary table
Description
The tbl_ard_summary()
function tables descriptive statistics for
continuous, categorical, and dichotomous variables.
The functions accepts an ARD object.
Usage
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
)
Arguments
cards |
( |
by |
( |
statistic |
( |
type |
( |
label |
( |
missing , missing_text , missing_stat |
Arguments dictating how and if missing values are presented:
|
include |
( |
overall |
(scalar |
Details
There are three types of additional data that can be included in the ARD to improve the default appearance of the table.
-
Attributes: When attributes are included, the default labels will be the variable labels, when available. Attributes can be included in an ARD with
cards::ard_attributes()
orard_stack(.attributes = TRUE)
. -
Missing: When missing results are included, users can include missing counts or rates for variables with
tbl_ard_summary(missing = c("ifany", "always"))
. The missing statistics can be included in an ARD withcards::ard_missing()
orard_stack(.missing = TRUE)
. -
Total N: The total N is saved internally when available, and it can be calculated with
cards::ard_total_n()
orard_stack(.total_n = TRUE)
.
Value
a gtsummary table of class "tbl_ard_summary"
Examples
library(cards)
ard_stack(
data = ADSL,
ard_categorical(variables = "AGEGR1"),
ard_continuous(variables = "AGE"),
.attributes = TRUE,
.missing = TRUE,
.total_n = TRUE
) |>
tbl_ard_summary()
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)
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)