library(shiny)
library(rtables)
library(gtsummary)
library(gt)
library(magrittr)
ui <- bslib::page_fluid(
table_with_settings_ui(id = "rtables_table"),
table_with_settings_ui(id = "gtsummary_table"),
table_with_settings_ui(id = "gt_table")
)
server <- function(input, output, session) {
table_r_rtables <- reactive({
l <- basic_table() %>%
split_cols_by("ARM") %>%
analyze(c("SEX", "AGE"))
build_table(l, DM)
})
table_r_gtsummary <- reactive({
gtsummary::tbl_summary(mtcars)
})
table_r_gt <- reactive({
mtcars %>%
gt::gt() %>%
gt::tab_header(title = "Motor Trend Car Road Tests")
})
table_with_settings_srv(id = "rtables_table", table_r = table_r_rtables)
table_with_settings_srv(id = "gtsummary_table", table_r = table_r_gtsummary)
table_with_settings_srv(id = "gt_table", table_r = table_r_gt)
}
if (interactive()) {
shinyApp(ui, server)
}
Run the code above in your browser using DataLab