This module provides centralized sorting functionality to ensure consistent ordering across all output types (tables, plots) by using explicit order columns instead of relying on factor levels that can be overridden. Apply comprehensive sorting order to survey data
add_sorting_order_vars(
data,
sort_dep_by = ".variable_position",
sort_indep_by = ".factor_order",
sort_category_by = NULL,
descend = FALSE,
descend_indep = FALSE
)Dataset with added order columns: .dep_order, .indep_order, .category_order
Dataset with survey results
How to sort dependent variables
How to sort independent variable categories
How to sort response categories
Whether to reverse the dependent variable order