Skip to contents

[Stable]

Facilitate the re-combination of groups divided as reference and treatment groups; it helps in arranging groups of columns in the rtables framework and teal modules.

Usage

combine_groups(fct, ref = NULL, collapse = "/")

Arguments

fct

(factor)
the variable with levels which needs to be grouped.

ref

(string)
the reference level(s).

collapse

(string)
a character string to separate fct and ref.

Value

a list with first item ref (reference) and second item trt

(treatment).

Examples

groups <- combine_groups(
  fct = DM$ARM,
  ref = c("B: Placebo")
)

basic_table() %>%
  split_cols_by_groups("ARM", groups) %>%
  add_colcounts() %>%
  summarize_vars("AGE") %>%
  build_table(DM)
#>             B: Placebo    A: Drug X/C: Combination
#>               (N=106)             (N=250)         
#> ——————————————————————————————————————————————————
#> n               106                 250           
#> Mean (SD)   33.0 (6.3)           34.7 (7.1)       
#> Median         32.0                 33.0          
#> Min - Max   21.0 - 55.0         20.0 - 60.0