tbl_reg_summary {gtreg} | R Documentation |
Data Summary Table
Description
Function wraps gtsummary::tbl_summary()
to create a data summary
table often seen in regulatory submissions. Continuous variable summaries
are shown on multiple lines with additional summary statistics and percentages
are shown for categorical variables; precision levels estimated based on values observed.
Usage
tbl_reg_summary(
data,
by = NULL,
label = NULL,
statistic = list(all_continuous() ~ c("{N_nonmiss}", "{mean} ({sd})",
"{median} ({p25}, {p75})", "{min}, {max}", "{N_miss}"), all_categorical() ~
"{n} ({p}%)"),
digits = NULL,
type = NULL,
value = NULL,
missing = c("no", "yes", "ifany"),
missing_text = "Unknown",
missing_stat = "{N_miss}",
sort = all_categorical(FALSE) ~ "alphanumeric",
percent = c("column", "row", "cell"),
include = everything()
)
Arguments
data |
( |
by |
A column name (quoted or unquoted) in |
label |
( |
statistic |
List of formulas specifying types of summary statistics to display for each variable. |
digits |
( |
type |
List of formulas specifying variable types.
Accepted values are |
value |
List of formulas specifying the value to display for dichotomous
variables. gtsummary selectors, e.g. |
missing , missing_text , missing_stat |
Arguments dictating how and if missing values are presented:
|
sort |
( |
percent |
( |
include |
( |
Value
a 'tbl_reg_summary' object
Example Output
Example 1
See Also
See gtsummary::tbl_summary()
help file
See vignette for detailed tutorial
Examples
tbl_reg_summary_ex1 <-
df_patient_characteristics %>%
tbl_reg_summary(by = trt, include = c(marker, status))