79731872

Date: 2025-08-11 09:20:38
Score: 0.5
Natty:
Report link

Assuming you are after the percentage of each count relative to their group instead of 100%, you need to include the groups in denominator of tbl_hierarchical().

tbl_list <- lapply(group_vars, function(var) {
  gtsummary::tbl_hierarchical(
    data = adsl,
    denominator = adsl %>% 
      select(USUBJID, all_of(var)),
    id = USUBJID,
    by = .data[[var]],
    variables = c(SITEGR1, SITEID)
  )
})

enter image description here

Reasons:
  • Probably link only (1):
  • Has code block (-0.5):
Posted by: pascal