与renderUI缓慢闪亮的UI

时间:2017-11-20 16:08:17

标签: shiny

我很好奇我可以做些什么来提高以下示例代码的速度。当myList是一个小向量时,没问题。当myList是一个非常大的向量时,UI会挂起。下面的可重复示例,请提前感谢。

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 

0 个答案:

没有答案