Beginner question table1 in Shiny

Hi,

Welcome to the RStudio community!

Since we don't have your dataset, or at least a sample of it, it's hard to recreate the issue.
Here is a working example with one of the default datasets (CO2) from R

library(shiny)
library(shinydashboard)
library(table1)

ui <- dashboardPage(
  dashboardHeader(title = "Table1"),
  dashboardSidebar(),
  dashboardBody(
    box(tableOutput("T1")),
    box(selectInput('cat_var', 'Variable', c("Type", "Treatment")), width = 4
    )
  )
)

#Server
server <- function(input, output){
  
  output$T1 = renderTable({
    table1(~ conc + uptake | input$cat_var, data=CO2)
  })
  
}

shinyApp(ui, server)

If you need help on how to generate a reprex (to share data + code), read this guide. Shiny debugging and reprex guide

PJ

1 Like