library(magrittr) library(gt) library(ggplot2) library(htmltools) library(gtExtras) data = read.csv('https://docs.google.com/spreadsheets/d/1Bx5aKWk5ltA9HqU4Ma2dtdr12ih7ev5ZFyAeiFgqXw8/export?exportFormat=csv') table <- gt(data) %>% gt_theme_538() %>% tab_row_group(rows = match("Material", data$Plastic) & match("Application", data$Plumbing), label = paste0("Group A")) #tab_row_group(rows = match("Plastic", data$Material),label = paste0("Plastic")) %>% #row_group_order(groups=c("Copper","Plastic")) %>% #tab_header(title = gt::html("

Test

")) %>% #tab_style(style = list(cell_fill(color = "#FFCC00")),locations = cells_row_groups()) gtsave(table, file = "test.html") system("wkhtmltopdf -O landscape toc *.html output3.pdf")