refine_chapter_overview {saros.base} | R Documentation |
Processes A 'chapter_overview' Data Frame
Description
Processes A 'chapter_overview' Data Frame
Usage
refine_chapter_overview(
chapter_overview = NULL,
data = NULL,
chunk_templates = NULL,
label_separator = " - ",
name_separator = NULL,
single_y_bivariates_if_indep_cats_above = 3,
single_y_bivariates_if_deps_above = 20,
always_show_bi_for_indep = NULL,
hide_bi_entry_if_sig_above = 1,
hide_chunk_if_n_below = 10,
hide_variable_if_all_na = TRUE,
keep_dep_indep_if_no_overlap = FALSE,
organize_by = c("chapter", ".variable_label_prefix_dep", ".variable_name_indep",
".template_name"),
arrange_section_by = c(.chapter_number = FALSE, .variable_name_dep = FALSE,
.variable_name_indep = FALSE, .template_name = FALSE),
na_first_in_section = TRUE,
max_width_obj = 128,
max_width_chunk = 128,
max_width_file = 64,
max_width_folder_name = 12,
sep_obj = "_",
sep_chunk = "-",
sep_file = "-",
filename_prefix = "",
...,
progress = TRUE,
variable_group_dep = ".variable_group_dep",
variable_group_prefix = NULL,
n_range_glue_template_1 = "{n}",
n_range_glue_template_2 = "[{n[1]}-{n[2]}]",
log_file = NULL
)
Arguments
chapter_overview |
What goes into each chapter and sub-chapter
Data frame (or tibble, possibly grouped). One row per chapter. Should contain the columns 'chapter' and 'dep', Optionally 'indep' (independent variables) and other informative columns as needed. |
data |
Survey data
A data frame (or a srvyr-object) with the columns specified in the chapter_structure 'dep', etc columns. |
chunk_templates |
Chunk templates
Must contain columns |
label_separator |
Variable label separator
String to split labels on main question and sub-items. |
name_separator |
Variable name separator
String to split column names in data between main question and sub-items |
single_y_bivariates_if_indep_cats_above |
Single y bivariates if indep-cats above ...
Figures and tables for bivariates can become very long if the independent variable has many categories. This argument specifies the number of indep categories above which only single y bivariates should be shown. |
single_y_bivariates_if_deps_above |
Single y bivariates if dep-vars above ...
Figures and tables for bivariates can become very long if there are many dependent variables in a battery/question matrix. This argument specifies the number of dep variables above which only single y bivariates should be shown. Set to 0 to always show single y bivariates. |
always_show_bi_for_indep |
Always show bivariate for indep-variable
Specific combinations with a by-variable where bivariates should always be shown. |
hide_bi_entry_if_sig_above |
p-value threshold for hiding bivariate entry
Whether to hide bivariate entry if significance is above this value. Defaults to showing all. |
hide_chunk_if_n_below |
Hide result if N below
Whether to hide result if N for a given dataset is below this value. NOTE: Exceptions will be made to chr_table and chr_plot as these are typically exempted in the first place. This might change in the future with a separate argument. |
hide_variable_if_all_na |
Hide variable from outputs if containing all NA
Whether to remove variables if all values are NA. |
keep_dep_indep_if_no_overlap |
Keep dep-indep if no overlap
Whether to keep dep-indep rows if there is no overlap. |
organize_by |
Grouping columns
Column names used for identifying chapters and sections. |
arrange_section_by |
Grouping columns
Column names used for sorting section within each organize_by group. If character vector, will assume all are to be arranged in ascending order. If a named logical vector, FALSE will indicate ascending, TRUE descending. Defaults to sorting in ascending order (alphabetical) for commonly needed variable name/label info, and in descending order for chunk_templates as one typically wants univariates before bivariates. |
na_first_in_section |
Whether to place NAs first when sorting
Default ascending and descending sorting with |
max_width_obj , max_width_chunk , max_width_file |
Maximum object width
Maximum width for names of objects (in R/Python environment),
chunks (#| label: ) and optional files. Note, will always replace variable
labels with variable names, to avoid very long file names.
Note for filenames: Due to OneDrive having a max path of about
400 characters, this can quickly be exceeded with a long path base path,
long file names if using labels as part of structure, and hashing with
Quarto's |
max_width_folder_name |
Maximum clean folder name length
Whereas |
sep_obj , sep_chunk , sep_file |
Separator string
Separator to use between grouping variables. Defaults to underscore for object names and hyphen for chunk labels and file names. |
filename_prefix |
Prefix string for all qmd filenames
For mesos setup it might be useful to set these files (and related sub-folders) with an underscore
( |
... |
Dynamic dots Arguments forwarded to the corresponding functions that create the elements. |
progress |
Whether to display progress message
Mostly useful when hide_bi_entry_if_sig_above < 1 |
variable_group_dep |
Name for the variable_group_dep column
This column is used to group variables that are part of the same bivariate analysis. |
variable_group_prefix |
Set a prefix to more easily find it in your labels
By default, the .variable_group column is just integers. If you wish to use this as part of your object/label/filename numbering scheme, a number by itself will not be very informative. Hence you could set a prefix such as "Group" to distinguish this column from other columns in the chapter_structure. |
n_range_glue_template_1 , n_range_glue_template_2 |
Glue templates for the n_range columns to be created. |
log_file |
Path to log file
Path to log file. Set to NULL to disable logging. |
Value
Grouped tibble.
Examples
ref_df <- refine_chapter_overview(
chapter_overview = ex_survey_ch_overview
)