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
)

## Arguments

.data

Dataframe.

...

Arguments to summary_factorlist.

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 summary_factorlist table, usually 2.

Dataframe.

## Details

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)

## Examples

# 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"))
#> Error in summary_factorlist_stratified(., dependent, explanatory, split = c("sex.factor")): object 'explanatory' not found

# Double split
colon_s %>%
summary_factorlist_stratified(dependent, explanatory, split = c("sex.factor", "age.factor"))
#> Error in summary_factorlist_stratified(., dependent, explanatory, split = c("sex.factor",     "age.factor")): object 'explanatory' not found