library(magrittr) library(gt) library(ggplot2) library(htmltools) library(gtExtras) file_name <- ("pipe_insulation.csv") data <- read.csv(file_name) table <- gt(data) %>% tab_row_group( rows = which(rownames(data) %in% rownames(data[data$Material == "Phenolic Foam", ])), label = paste0("Phenolic Foam") ) %>% tab_row_group( rows = which(rownames(data) %in% rownames(data[data$Material == "Mineral Wool", ])), label = paste0("Mineral Wool") ) %>% row_group_order(groups=c("Phenolic Foam","Mineral Wool")) %>% tab_header(title = gt::html("

Schedule of Pipework Insulation

") ) table <- table %>% tab_style( style = list( cell_fill(color = "#FFCC00") ), locations = cells_row_groups() ) html_file_name <- paste0("pipe_insulation.html") gtsave(table, file = html_file_name) file_name <- ("pipe_lengths.csv") data = read.csv('https://docs.google.com/spreadsheets/d/1Bx5aKWk5ltA9HqU4Ma2dtdr12ih7ev5ZFyAeiFgqXw8/export?exportFormat=csv') head(data) #data <- read.csv(file_name) table <- gt(data) %>% #gt_theme_538() %>% tab_row_group( rows = which(rownames(data) %in% rownames(data[data$Material == "Copper" ])), label = "Copper" ) %>% #tab_row_group( # rows = which(rownames(data) %in% rownames(data[data$Material == "Plastic" ])), # label = "Plastic" #) %>% tab_footnote(footnote = "My little footnote",locations = cells_column_labels(columns = Application) ) %>% tab_options(table.width = "100%") %>% tab_source_note(source_note = "From edmunds.com") %>% # 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")