Hello,
I'm trying to style some tables that I'll compose together into one single plot using patchwork. I've found I can do that by wrapping a gt object with wrap_table, but that is confusingly stripping out some of the formatting I've applied to the gt object using tab_style.
So in the reprex, directly formatting the gt with tab_style, I can bold and capitalize the column names and it works as expected. But when I take the same call and use wrap_table around it, only the bold names remain--the capitalization is absent.
library(tibble)
library(gt)
library(patchwork)
tab_a <- tribble(
~colA, ~n,
"A", 1000,
"B", 2,
"C", 1
)
#tab_style formatting correctly applies bold and capitalization to a table
tab_a |>
gt() |>
tab_style(
style = list(
cell_text(weight = 'bold',
transform = 'capitalize')
),
locations = cells_column_labels(everything())
)
#tab_style formatting 'only' applies bold, not capitalization to a table
wrap_table(tab_a |>
gt() |>
tab_style(
style = list(
cell_text(weight = 'bold',
transform = 'capitalize')
),
locations = cells_column_labels(everything())
)
)
Maybe I'm going about this all wrong, but any help is much appreciated!