
Standard All vs Some (e.g. Related AEs) column structure
Source:R/risk_diff_col_struct.R
some_v_all_col_struct.RdStandard All vs Some (e.g. Related AEs) column structure
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 byadd_combo_levels()with an additionalis_controlcolumn indicating whether the virtual level will act as a reference (TRUE) or active (FALSE) group.- trtvar
(
character(1)orNULL)
the treatment variable to split by. Defaults to the treatment variable incolspan_trt_map.- subgrp_var
(
character(1)orNULL)
the name of the subgroup variable to split by within thetrtvarsplit- subgrp_lbl
(
character(1))
The label to put above the combination level representingsubgrp_lvls- all_lbl
(
character(1))
The label to put above the "All" column- subgrp_lvls
(
characgter)
All level(s) to be included in thesubgrp_lblcolumn.- .pre
(
listoffunctions)
Passed tortables::make_split_fun()asprefor treatment splitting.- .post
(
listoffunctions)
Passed tortables::make_split_fun()aspostfor treatment splitting after the standard column-structure processing.
Details
This column structure generating function is for comparing a single portion of the data (as represented by
level(s) of subgrp_var) against the full data, comparison of AE counts to treatment-related AE counts
being a motivating example.
Examples
library(junco)
dat <- create_colspan_var(
data.frame(
TRT01A = factor(rep(c("Placebo", "Active 1", "Active 2"), each = 5)),
GRADE = factor(rep(paste("Grade ", 1:5), 3))
),
non_active_grp = "Placebo",
non_active_grp_span_lbl = "Control",
active_grp_span_lbl = "Active Treatment",
colspan_var = "colspan_trt",
trt_var = "TRT01A"
)
colspan_trt_map <- create_colspan_map(
dat,
non_active_grp = "Placebo",
non_active_grp_span_lbl = "Control",
active_grp_span_lbl = "Active Treatment",
colspan_var = "colspan_trt",
trt_var = "TRT01A"
)
lyt <- basic_table() |>
some_v_all_col_struct(
colspan_trt_map,
subgrp_var = "GRADE",
subgrp_lvls = c("Grade 4", "Grade 5"),
subgrp_lbl = "High Grade",
all_lbl = "All Grades")
build_table(lyt, dat)
#> Active Treatment Control
#> Active 1 Active 2 Placebo
#> (N=5) (N=5) (N=5)
#> All Grades High Grade All Grades High Grade All Grades High Grade
#> ——————————————————————————————————————————————————————————————————————————————