dimanche 26 juin 2022

How to update the choices of a checkbox in shiny?

I want to create an app that takes a path of a dataset and shows the variables of the dataset as items of a checkbox. My code is this:

ui <- fluidPage(
  
  #geting a dataset
  textInput("df", "Enter the path of your dataset: "),
  
  #getting the variables of dataset
  uiOutput("variables")
)
server <- function(input, output){
  
  dataTable <- reactive({
    read.csv(input$df)
  })
  
  output$variables <- renderUI({
    checkboxGroupInput("variables", "Select your variables: ", choices = names(dataTable))
  })
)

But after entering the path of dataset, it shows nothing for checkbox. How can I fix this?




Aucun commentaire:

Enregistrer un commentaire