Description Usage Arguments Value Examples
This function allows you to calculate counts, proportions, or a combination of both for binary or multiple level categorical variables. NOTE: ALL CATEGORICAL VARIABLES MUST BE CONVERTED TO FACTORS BEFORE USING THIS FUNCTION. For binary variables, make sure vairables are coded as 0-1 and choose ‘type = ’binary''. This will produce output for the case where the variable equals 1. If both levels of the binary variable are desired, choose ‘type = ’multiple'' which produces output for all levels of the categorical variable.
1 2 | quantify_categorical(covariate, df, grouping_var, type = c("multiple",
"binary"), display = "CP", show_pval = TRUE, digits = 1)
|
covariate |
Categorical variable of interest |
df |
Dataset containing covariate |
grouping_var |
Variable to group by (will be columns of table) |
type |
Type of categorical variable: 'binary' or 'multiple' (Note: If you would like to see both levels of a binary variable in the output, then specify 'multiple'). |
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 counts/proportions of categorical variable at each level of grouping variable
1 2 3 4 5 | ## Not run:
quantify_categorical(covariate = Edu_4cat, obpv_baseline, grouping_var = obpv_quintile,
type = 'multiple', display = 'CP')
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.