Shiny select input capable of handling massive number of selections?

I am trying to configure an input for my shiny app that will allow the user to search through and select from a few hundred thousand choices. I have tried doing a client-side DT data table with select buttons added, but it can't handle the size. And when I run the app trying to use selectInput("myinput", "Select...", choices = df$names) the app just hangs, presumably because it would take ages for it to load all the choices.

Are there any known inputs or R packages that I could take advantage of that would provide this functionality?

Why not a serverside DT ?

Loading the data isn't the issue, it's having an input method that is robust enough to handle all the choices.

the issue you have is 100,000 is a lot. for typical short strings this could get up to 10mb or so. Browser/Web memory and transfer times and so. Traditional selectInput would preload it all into the UI. so thats definitely out.
selectizeInput is much better, it has a server option etc, but even then i cant get good performance beyond 30,000 or so.

df <- data.frame(
  names = paste0("VAR_",1:30000)

ui <- fluidPage(
  selectizeInput("myinput", "Select...", choices = NULL) 

server <- function(input, output, session) {
  updateSelectizeInput(session, 'myinput', choices = df$names, server = TRUE,
                       options= list(maxOptions = length(df$names)))

shinyApp(ui, server)

Devils advocate wise, are you sure that a single select list would even be optimal from a user perspective given the enormity of the list ? From my own experience as a user I'd expect what I'm searching for to be structured hierarchically to help me find it...

1 Like

No, you're absolutely right. I'm gonna think of a different approach to this and find a better solution. Selectize Input is handy though, thanks for your help!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.