library(magrittr) library(gt) library(ggplot2) library(htmltools) library(gtExtras) #data = read.csv('https://docs.google.com/spreadsheets/d/1Bx5aKWk5ltA9HqU4Ma2dtdr12ih7ev5ZFyAeiFgqXw8/export?exportFormat=csv') data = read.csv('pop.csv') head(data) table <- gt(data) %>% tab_row_group( rows = which(rownames(data) %in% rownames(data[data$D1 == "C11" ],)), label = "C11" ) %>% tab_row_group( rows = which(rownames(data) %in% rownames(data[data$D1 == "C12" ],)), label = "C12" ) %>% #tab_options(table.width = "100%") %>% # row_group_order(groups=c("Copper","Plastic")) %>% tab_header(title = gt::html("

Schedule of Pipe Lenghts

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