Prework
Description
Thanks for all the efforts to support flexible output types! We noticed the following issue for RTF specifically:
For tables with multi-column stub (multiple rowname_col's and/or row_grp_as_column = TRUE), we can use tab_stubhead() to define the labels. These can be one label for all columns, one label per column, or no labels. All works well in HTML but doing 1 label or no labels fails in RTF:
library(gt)
# Both stubs labeled - OK
tab1 <- exibble |>
gt(
rowname_col = c("group", "char")
)|>
tab_stubhead(
label = c("Group","Char")
)
tab1 |>
gt::gtsave("test.rtf")
# Both stubheads labeled w/ empty strings - OK
tab2 <- exibble |>
gt(
rowname_col = c("group", "char")
)|>
tab_stubhead(
label = c("","")
)
tab2 |>
gt::gtsave("test.rtf")
# One stubhead label - Error
tab3 <- exibble |>
gt(
rowname_col = c("group", "char")
) |>
tab_stubhead(
label = c("Group / Char")
)
tab3 |>
gt::gtsave("test.rtf")
#> Error in `x[[i]]`:
#> ! subscript out of bounds
# No stubhead labels - Error
tab4 <- exibble |>
gt(
rowname_col = c("group", "char")
)
tab4 |>
gt::gtsave("test.rtf")
#> Error in `x[[i]]`:
#> ! subscript out of bounds
Created on 2026-01-26 with reprex v2.1.1
Prework
Description
Thanks for all the efforts to support flexible output types! We noticed the following issue for RTF specifically:
For tables with multi-column stub (multiple rowname_col's and/or row_grp_as_column = TRUE), we can use
tab_stubhead()to define the labels. These can be one label for all columns, one label per column, or no labels. All works well in HTML but doing 1 label or no labels fails in RTF:Created on 2026-01-26 with reprex v2.1.1