# Load required packages
library(gt)
library(htmltools)
# Create sample data frames
data1 <- data.frame(
Category = c("A", "B", "C"),
Value = c(10, 20, 30)
)
data2 <- data.frame(
Category = c("X", "Y", "Z"),
Value = c(15, 25, 35)
)
# Create gt tables
table1 <- data1 %>%
gt() %>%
tab_header(title = "Table 1")
table2 <- data2 %>%
gt() %>%
tab_header(title = "Table 2")
# Create an HTML document
html_content <- tagList(
tags$head(tags$title("Combined Tables")),
tags$body(
table1,
table2
)
)
# Save HTML document
save_html(html_content, file = "combined_tables.html")