I would like to create a summary table using gtsummary as below:
library(tidyverse)
library(gtsummary)
trial %>%
select(
stage, grade
) %>%
gtsummary::tbl_summary(by = "grade")
Except with the "by" parameter appearing as rows instead of columns. For my use case, there is a nested relationship between the variables to be summarized ("stage" in the example) and the "by" parameter. I.e., a given stage only appears in within a specific grade.
A solution similar to Method 2 described in https://stackoverflow.com/a/65668806/5745045 might work, but that implementation doesn't appear to work anymore.
Cheers and thanks in advance.