
Standard Column Structure With Grouped Treatments and Difference Columns
Source:R/risk_diff_col_struct.R
grouped_cols_w_diffs.RdStandard Column Structure With Grouped Treatments and Difference Columns
Arguments
- lyt
(
PreDataTableLayouts). The layout to modify. This should virtually always be the object returned bybasic_table.- colspan_trt_map
(
data.frame). The spanning label map for the main columns, as given bycreate_colspan_map.- combo_map_df
(
data.frameorNULL). A combination data frame as defined byrtables::add_combo_levels()with an additionalis_controlcolumn indicating whether the virtual level will act as a reference (TRUE) or active (FALSE) group.- comp_map
(
data.frameorNULL). A data.frame with columns"active","comparator","active_is_combo"and"comparator_is_combo", orNULLindicating the default comparison behavior (See Details).- diff_cols
(
logical(1)). Whether the risk difference column structure should be included (TRUE, the default) or not (FALSE).- diffs_label
(
character(1)). The spanning label for the risk difference section of columns- .main_pre
(
listoffunctions). Passed tortables::make_split_fun()asprefor treatment split in main structure.- .main_post
(
listoffunctions). Passed tortables::make_split_fun()aspostfor treatment split in main structure.- .rr_pre
(
listoffunctions). Passed tomake_multicomp_splfun()as.prefor risk difference faceting.- .rr_post
(
listoffunctions). Passed tomake_multicomp_splfun()as.postfor risk difference faceting.
Details
This function combines multiple rtables column splitting
instructions with customized split functions to create a column
structure with treatment columns for each treatment arm (optionally
including combination arms), grouped by active and non-active, with
risk difference columns comparing active arm(s) against one or more
non-active controls. It is intended for use in layouts that will
use a_freq_j() or similar junco-style analysis functions which
support risk difference columns and accept a ref_path argument.
It is equivalent to the following sequence of layout instructions:
splitting on a colspan labeling variable with
rtables::trim_levels_to_map()as the split function;splitting on treatment;
adding a (non-nested) overall column acting as the risk difference spanning label; and finally
splitting on treatment using
make_multicomp_splfun()as the split function
In addition, it supports:
comparison against multiple control groups (as specified by
colspan_trt_mapand/orcomp_map),virtual combination-levels as active an/or control "treatments" (via
combo_map_df),full control of which comparisons are performed, and their order (via
comp_map).
If combination levels are declared via combo_map_df but none
appear in colspan_trt_map, all combinations will be added to the
appropriate group within the map based on combo_map_df$is_control
(assumed to be FALSE if the column is missing), with a warning.
If some combination levels do appear in combo_map_df but
others do not, a warning will be thrown but the missing combination
levels will not be added to the treatment map.
By default (when comp_map is NULL), all active treatments,
including active combinations, will be compared against all control
groups.
The risk difference section of the structure is declared using
make_multicomp_splfun(). Reference paths are inferred
automatically from colspan_trt_map (after combination levels have
been added if necessary).
For the purposes of pathin in the resulting structure,
diffs_label will be both the split name and split value of the
parent containing the individual risk difference columns.
See also
Other riskdiff_col_struct:
make_multicomp_splfun()