Reshapes and standardises mental disorder prevalence tables prior to
contingency-table generation.
Usage
make_disorders_tb(
data_tb,
age_vars_chr = c("AgeGroup9", "...1"),
age_groups_chr = c("16–24", "25–34", "35–44", "45–54", "55–64", "65–74",
"75–85"),
rows_by_sex_ls = list(Female = 31:43, Male = 17:29),
sex_var_1L_chr = "SEXP"
)
Arguments
- data_tb
Input prevalence table.
- age_vars_chr
Variable names describing age groups.
- age_groups_chr
Age groups to retain.
- rows_by_sex_ls
Row locations corresponding to each sex.
- sex_var_1L_chr
Name of the sex variable.
Value
A tibble containing disorder prevalence estimates by age and sex.
Details
The function harmonises age-group labels, assigns sex labels and returns
a tidy table suitable for modelling workflows.
Examples
if (FALSE) { # \dontrun{
disorders_tb <- make_disorders_tb(
data_tb = survey_tb
)
} # }