0

I'm curious what I can do to improve the speed of the following sample code. When myList is a small vector, no problem. When myList is a very large vector, the UI hangs. Reproducible example below, thank you in advance.

ui <- {
  fluidPage(
    h3('UI Test'),
    uiOutput("chooser"),
    plotOutput('myPlot')
    )
}

server <- function(input, output, session) {

myList <- reactive({
    gl(2000, 1)
    #gl(200000, 1) vector this size hangs the UI
})

output$chooser <- renderUI({
    myList <- myList()
    selectizeInput("chooser","Select ID:", myList, multiple=FALSE)
})

output$myPlot <- renderPlot({
    pos <- which(myList() == input$chooser)
    plot(pos:10000)
})

} # end server


shinyApp(ui, server) #run 
user350540
  • 429
  • 5
  • 17
  • Sending large sets of data to the browser will ALWAYS be slow. Are you not able to use an input that doesn't require 200K+ options? – Ryan Morton Nov 20 '17 at 18:26
  • @Ryan, yes. I changed to a text input. The use of a selectize here really is bad design in the sense that no user is expected to flip through such a HUGE list. In my real problem, this is a list of names in a data set that has hundreds of thousands of rows. So, the benefit of selectize is the autofill so when a user starts typing it is easy to find the individual. We lose that with textInput, but the design doesn't hang the UI so, maybe it's a trade off – user350540 Nov 20 '17 at 19:42
  • It seems like you should be able to autocomplete without loading the whole list: https://stackoverflow.com/questions/35265920/auto-complete-and-selection-of-multiple-values-in-text-box-shiny – Ryan Morton Nov 20 '17 at 19:47

0 Answers0