Input of long list of elements in inputSelect

shiny

#1

Hi
I have a dataframe and would like to use one column as the choice option and one column as the description in a selectInput. I don't want to write out everything explicitly. Any idea how to do this. Here is a short example of what did not work

mydata<- data.frame(sector = c('EDT','CHE'), description = c('Electricity distribution', 'Chemical industry'))

shinyApp(
  ui = fluidPage(
    selectInput("variable", "Variable:",
                choices =c(mydata$sector= mydata$description)
      )
   ),
  server = function(input, output) {
   }
)

Thanks
Renger


#2

try

choices = setNames(mydata$sector, mydata$description)

#3

Thanks! Works like a dream
Renger