gtsummary --> gt --> tab_style()

Hi @shannon.pileggi , remember put a reproducible example of data.

See this reprex

With a toy data, Im make this example:

library(gtsummary)
library(gt)

data <- data.frame(
  trt = c("A", "A", "B", "B"),
  grade = c("Grade1", "Grade2", "Grade1", "Grade2"))

summary_table <- data|>
  select(trt, grade) |>
  tbl_summary(by = trt) |>
  as_gt() 

summary_table

styled_table <- summary_table |>
  tab_style(
    style = list(
      cell_fill(color = "#FFFBC8")),    
      locations = cells_body(
      rows = 1,
      columns = c("label"))) # Assuming "label" is the correct column name

styled_table

image

1 Like