View source: R/table_unweightedpctn.R
table_unweightedpctn | R Documentation |
Compute unweighted percent and N for multiple variables, disaggregated
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
)
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. |
A tibble with percent and N for each level of each variable in vars_demo
Other table functions:
table_basicstats()
,
table_weightedpct()
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.