Create table of demographics statistics by most-likely latent subtype
Source:R/table_subtype_by_demographics.R
table_subtype_by_demographics.Rd
Create table of demographics statistics by most-likely latent subtype
Arguments
- patient_data
- subtype_and_stage_table
- sust_data
a data.frame combining
patient_data
andsubtype_and_stage_table
bycbind()
- footnotes_as_letters
logical whether to convert footnote
- demographic_vars
character varnames to compute statistics for symbols to letters (TRUE) instead of numbers (FALSE)
- ...
Arguments passed on to
gtsummary::tbl_summary
data
(
data.frame
)
A data frame.by
(
tidy-select
)
A single column fromdata
. Summary statistics will be stratified by this variable. Default isNULL
.label
(
formula-list-selector
)
Used to override default labels in summary table, e.g.list(age = "Age, years")
. The default for each variable is the column label attribute,attr(., 'label')
. If no label has been set, the column name is used.statistic
(
formula-list-selector
)
Specifies summary statistics to display for each variable. The default islist(all_continuous() ~ "{median} ({p25}, {p75})", all_categorical() ~ "{n} ({p}%)")
. See below for details.digits
(
formula-list-selector
)
Specifies how summary statistics are rounded. Values may be either integer(s) or function(s). If not specified, default formatting is assigned viaassign_summary_digits()
. See below for details.type
(
formula-list-selector
)
Specifies the summary type. Accepted value arec("continuous", "continuous2", "categorical", "dichotomous")
. If not specified, default type is assigned viaassign_summary_type()
. See below for details.value
(
formula-list-selector
)
Specifies the level of a variable to display on a single row. The gtsummary type selectors, e.g.all_dichotomous()
, cannot be used with this argument. Default isNULL
. See below for details.missing,missing_text,missing_stat
Arguments dictating how and if missing values are presented:
missing
: must be one ofc("ifany", "no", "always")
.missing_text
: string indicating text shown on missing row. Default is"Unknown"
.missing_stat
: statistic to show on missing row. Default is"{N_miss}"
. Possible values areN_miss
,N_obs
,N_nonmiss
,p_miss
,p_nonmiss
.
sort
(
formula-list-selector
)
Specifies sorting to perform for categorical variables. Values must be one ofc("alphanumeric", "frequency")
. Default isall_categorical(FALSE) ~ "alphanumeric"
.percent
(
string
)
Indicates the type of percentage to return. Must be one ofc("column", "row", "cell")
. Default is"column"
.In rarer cases, you may need to define/override the typical denominators. In these cases, pass an integer or a data frame. Refer to the
?cards::ard_categorical(denominator)
help file for details.include
(
tidy-select
)
Variables to include in the summary table. Default iseverything()
.
Examples
patient_data = sim_data |>
dplyr::filter(.data$Category == "Patient")
table = sim_subtype_and_stage_table
table_subtype_by_demographics(patient_data, table,
demographic_vars = "Sex")
Characteristic
Overall
N = 181
Subtype 1
N = 11
Subtype 3
N = 171
p-value
1 n (column %)
2 Group comparison was done by Fisher’s exact test