It appears for second and then disappears.But i am able to see the report . I can see that warning error in my console as well .Please help me on this. Thank you
library(shiny)
library(DT)
library(leaflet)
library(dplyr)
ui <- fluidPage(
selectInput(
"FILE",
"Select the Report:",
choices = c("tbl1","tbl2","tbl3")),
checkboxGroupInput(
"col_n",
"Columns to display:",
choices = c()
),
DT::dataTableOutput("table_data")
)
server <- function(input, output,session) {
df <- reactive ({
switch(input$FILE,
"tbl1" = iris,
"tbl2" = mtcars,
"tbl3" = faithful
)
})
observeEvent(input$FILE,{
req(df())
updateCheckboxGroupInput(
session,
"col_n",
choices = colnames(df()),
selected = colnames(df())
)
})
output$table_data <- DT::renderDataTable({
req(input$col_n)
DT::datatable(
df() %>% select_at(input$col_n),
rownames = FALSE)
})
}
shinyApp(ui, server)