Description Usage Arguments Value Examples
This function allows you to calculate counts, proportions, or a combination of both for all binary or multiple level categorical variables in a dataset. The function will take two vectors of categorical variables split by 'binary' and 'multiple' levels. NOTE: ALL CATEGORICAL VARIABLES MUST BE CONVERTED TO FACTORS BEFORE USING THIS FUNCTION. For binary variables, make sure vairables are coded as 0-1. This function will produce output for the case where the binary variable equals 1. If both levels of the binary variable are desired, include the binary variable in the 'multiple' level categorical variable vector. For 'display' options: 'CP' = counts and proportions, 'C' = counts, and 'P' = proportions (defaults to 'CP')
1 2 | summarize_all_categorical(df, binary_cat_vars, multiple_cat_vars,
grouping_var, display = "CP", show_pval = TRUE, digits = 1)
|
df |
Dataset containing covariates of interest |
binary_cat_vars |
Vector of binary variables (in 0-1 format) |
multiple_cat_vars |
Vector of multiple level categorical variables |
grouping_var |
Variable to group by (will be columns of table) |
display |
How to display results: 'CP' = counts and proportions, 'C' = counts, 'P' = proportions (defaults to 'CP') |
digits |
Number of digits to round decimals |
A data frame summarizing mean/sd of covariate at each level of grouping variable
1 2 3 4 5 | ## Not run:
summarize_all_categorical(df = obpv_baseline, binary_cat_vars = binary_cat_vars,
multiple_cat_vars = multiple_cat_vars, grouping_var = obpv_quintile, display = 'CP', digits = 1)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.