library(magrittr)
library(gt)
library(ggplot2)
library(htmltools)
library(gtExtras)
data <- read.csv("pipe_insulation.csv")
table <- gt(data) %>%
gt_theme_538() %>%
opt_table_font('courier') %>%
tab_row_group(rows = which(data$Material == "Phenolic Foam" & data$Manufacturer == "TYUY"),label = paste0("Group Test")) %>%
tab_row_group(rows = which(data$Material == "NEW" & data$Manufacturer == "Kingspan"),label = paste0("Group C")) %>%
tab_row_group(rows = which(data$Material == "Mineral Wool" & data$Manufacturer == "ISOVER"),label = paste0("Group B")) %>%
#row_group_order(groups=c("Phenolic Foam","Mineral Wool")) %>%
tab_header(title = gt::html("
Pipework Insulation
")) %>%
tab_style(style = list(cell_fill(color = "#FFCC00")),locations = cells_row_groups())
gtsave(table, file = "pipe_insulation.html")
data = read.csv('https://docs.google.com/spreadsheets/d/1Bx5aKWk5ltA9HqU4Ma2dtdr12ih7ev5ZFyAeiFgqXw8/export?exportFormat=csv')
#data %>%
# mutate(
# link = map(link, ~ htmltools::a(href = .x, "website")),
# link = map(link, ~ gt::html(as.character(.x))))
table <- gt(data) %>%
gt_theme_538() %>%
tab_row_group(rows = which(data$Material == "Copper" & data$D1 == "C12"),label = paste0("Group Test")) %>%
tab_row_group(rows = which(data$Material == "Plastic" & data$D1 == "C11"),label = paste0("Group C")) %>%
tab_row_group(rows = which(data$Material == "Plastic" & data$D1 == "C13"),label = paste0("Group B")) %>%
tab_header(title = gt::html("Pipe Lengths
")) %>%
tab_style(style = list(cell_fill(color = "#FFCC00")),locations = cells_row_groups())
gtsave(table, file = "pipe_lengths.html")
system("wkhtmltopdf -O landscape toc *.html output3.pdf")