summary_factorlist_stratified | R Documentation |
A function that takes a single dependent variable with a vector of explanatory variable names (continuous or categorical variables) to produce a summary table.
summary_factorlist_stratified(
.data,
...,
split,
colname_sep = "|",
level_max_length = 10,
n_common_cols = 2
)
.data |
Dataframe. |
... |
Arguments to |
split |
Quoted variable name to stratify columns by. |
colname_sep |
Separator for creation of new column name. |
level_max_length |
Maximum name for each factor level contributing to column name. |
n_common_cols |
Number of common columns in |
This function aims to produce publication-ready summary tables for
categorical or continuous dependent variables. It usually takes a categorical
dependent variable to produce a cross table of counts and proportions
expressed as percentages or summarised continuous explanatory variables.
However, it will take a continuous dependent variable to produce mean
(standard deviation) or median (interquartile range) for use with linear
regression models.
Stratify a summary_factorlist
table (beta testing)
Dataframe.
# Table 1 - Perforation status stratified by sex ----
explanatory = c("age", "obstruct.factor")
dependent = "perfor.factor"
# Single split
colon_s %>%
summary_factorlist_stratified(dependent, explanatory, split = c("sex.factor"))
# Double split
colon_s %>%
summary_factorlist_stratified(dependent, explanatory, split = c("sex.factor", "age.factor"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.