Help making stratified summary_factorlist tables

ff_stratify_helper(df.out, .data)

Arguments

df.out

Output from summary_factorlist

.data

Original data frame used for summary_factorlist.

Examples

library(dplyr)
explanatory = c("age.factor", "sex.factor")
dependent = "perfor.factor"

# Pick option below
split = "rx.factor"
split = c("rx.factor", "node4.factor")

# Piped function to generate stratified crosstabs table
colon_s %>%
  group_by(!!! syms(split)) %>% #Looks awkward, but avoids unquoted var names
  group_modify(~ summary_factorlist(.x, dependent, explanatory)) %>%
  ff_stratify_helper(colon_s)
#>  Treatment >4 positive nodes label      levels         No      Yes
#>        Obs                No         <40 years   14 (6.3)  0 (0.0)
#>        Obs                No       40-59 years  89 (40.3) 3 (42.9)
#>        Obs                No         60+ years 118 (53.4) 4 (57.1)
#>        Obs                No            Female 101 (45.7) 3 (42.9)
#>        Obs                No              Male 120 (54.3) 4 (57.1)
#>        Obs               Yes         <40 years  10 (11.8) 1 (50.0)
#>        Obs               Yes       40-59 years  31 (36.5) 1 (50.0)
#>        Obs               Yes         60+ years  44 (51.8)  0 (0.0)
#>        Obs               Yes            Female  44 (51.8) 1 (50.0)
#>        Obs               Yes              Male  41 (48.2) 1 (50.0)
#>        Lev                No         <40 years   14 (6.5)  0 (0.0)
#>        Lev                No       40-59 years  78 (36.3) 3 (50.0)
#>        Lev                No         60+ years 123 (57.2) 3 (50.0)
#>        Lev                No            Female  89 (41.4) 2 (33.3)
#>        Lev                No              Male 126 (58.6) 4 (66.7)
#>        Lev               Yes         <40 years    4 (4.7) 1 (25.0)
#>        Lev               Yes       40-59 years  33 (38.8) 1 (25.0)
#>        Lev               Yes         60+ years  48 (56.5) 2 (50.0)
#>        Lev               Yes            Female  39 (45.9) 3 (75.0)
#>        Lev               Yes              Male  46 (54.1) 1 (25.0)
#>    Lev+5FU                No         <40 years   15 (6.9)  0 (0.0)
#>    Lev+5FU                No       40-59 years  72 (33.2) 2 (25.0)
#>    Lev+5FU                No         60+ years 130 (59.9) 6 (75.0)
#>    Lev+5FU                No            Female 115 (53.0) 4 (50.0)
#>    Lev+5FU                No              Male 102 (47.0) 4 (50.0)
#>    Lev+5FU               Yes         <40 years  11 (13.9)  0 (NaN)
#>    Lev+5FU               Yes       40-59 years  31 (39.2)  0 (NaN)
#>    Lev+5FU               Yes         60+ years  37 (46.8)  0 (NaN)
#>    Lev+5FU               Yes            Female  44 (55.7)  0 (NaN)
#>    Lev+5FU               Yes              Male  35 (44.3)  0 (NaN)