selectInput with large number of "choices"

829 views
Skip to first unread message

António M. Rodrigues

unread,
Nov 17, 2015, 11:25:44 AM11/17/15
to Shiny - Web Framework for R
In a shiny app I need to create a "select list input control" (selectInput) whose choices come from a postgresql table with 25473 rows.

I set the connection to postgres with RPostgresql, create a new dataframe using dbGetQuery, with two columns.

Then I create a suitable list (for the "choices" parameter) with the code:

X2 <- list(X[2,1])
for (i in 2:length(X[,2])) {
  X[i] <- X[i,1]
}

which takes its time...

The app takes ages to load in a browser and doesn't even load all values in the app viewer (in RStudio).

Is there any more efficient way of doing this?

Thanks in advance,
António

Joe Cheng

unread,
Nov 17, 2015, 11:41:44 AM11/17/15
to António M. Rodrigues, Shiny - Web Framework for R
See the section on server-side handling in this article: http://shiny.rstudio.com/articles/selectize.html
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/2fa90463-dd85-42ca-8c4c-b6ccf80bb80b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages