Dear forum users,
This is the first time I use this forum. As a novice with Shiny I am stuck with creating a Table1 in Shiny. When I execute the code with one of my variables in RenderTable instead of 'input$cat_var' , the code runs fine (showing Table1 in a dashboard). However this is not reactive. Therefore I wanted to use 'input$cat_var'. It is probably a very easy question to answer, but I have been going over it for hours and cannot figure it out.
ui <- dashboardPage(
dashboardHeader(title = "Table1"),
dashboardSidebar(),
dashboardBody(
box(tableOutput("T1")),
box(selectInput('cat_var', 'Variable', c("BRAF", "RAS")), width = 4
)
)
)
#Server
server <- function(input, output){
output$T1 = renderTable({
table1(~ Gender + Age + Sidedness + Res_Prim + Adjuv + diffgr + L1WHO | input$cat_var, data=dataset, render.missing=NULL, render.categorical="FREQ (PCTnoNA%)")
})
}
shinyApp(ui, server)