table_unweightedpctn {whomds} | R Documentation |
Compute unweighted percent and N for multiple variables, disaggregated
Description
Compute unweighted percent and N for multiple variables, disaggregated
Usage
table_unweightedpctn(
df,
vars_demo,
group_by_var = NULL,
spread_by_group_by_var = FALSE,
group_by_var_sums_to_100 = FALSE,
add_totals = FALSE
)
Arguments
df |
a data frame of individual survey data, where each row is an individual |
vars_demo |
a character vector of names of variables to calculate percent and N for |
group_by_var |
a string (length 1) with the name of the variable from |
spread_by_group_by_var |
logical determining whether to pass |
group_by_var_sums_to_100 |
logical determining whether percentages sum to 100 along the margin of |
add_totals |
logical determining whether to create total rows or columns (as appropriate) that demonstrate the margin that sums to 100. Default is FALSE. |
Value
A tibble with percent and N for each level of each variable in vars_demo
See Also
Other table functions:
table_basicstats()
,
table_weightedpct()
Examples
table_unweightedpctn(df_adults, vars_demo = c("sex", "age_cat", "work_cat", "edu_cat"))
table_unweightedpctn(df_adults, vars_demo = c("sex", "age_cat", "work_cat", "edu_cat"),
group_by_var = "disability_cat")
table_unweightedpctn(df_adults, vars_demo = c("sex", "age_cat", "work_cat", "edu_cat"),
group_by_var = "disability_cat", spread_by_group_by_var = TRUE)