adding extra header to the table and wrap it to headers

I have a function which creating a table like below and i want to add one more header to the table and merger the header at the first column.

i want to export this table to excel thats why looking for another solution , tried with flextable already

tbl_summmary <-
  tibble(
    outcome = c("A (%)", "B (%)", "C (%)", "D (%)", "Total (n)"),
    group_1 = c(.25, .25, .125, .325, 10),
    group_2 = c(.50, 0.0, .325, .125, 20),
    group_3 = c(.10, .40, .125, .325, 40))

tbl_summmary %>% as.data.frame()

output should be look like

image

You want the gt package for presentation tables

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.