首页 > 解决方案 > 当我有选择 > 1000 时,Shiny 不会向我显示整个 selectInput

问题描述

我写了一个简单的例子来说明我在做什么。我想在 selectInput 中显示 3000 个数字。这些数字必须在反应函数中,因为在我的原始工作中,数据来自文件。

我的问题是,当我运行应用程序时,它只显示 1000 个数字,而不是整个数据(3000 个数字)。

我已经看到这篇文章用> 1000个选项更新服务器端选择输入的选择失败,但我不知道如何使用uiOutput和renderUI来做到这一点。

谁能帮我?

首先十分感谢

编码:

library(shiny)

ui <- fluidPage(
  titlePanel("Numbers"),
  sidebarLayout(
    sidebarPanel(
      uiOutput('selectUI')
    ),
    mainPanel(
      
    )
  )
)

server <- function(input, output) {
  
  num <- reactive({
    data = c(1:3000)
    return(data)
  })
  
  output$selectUI <- renderUI({
    selectInput(inputId = 'options', "Select one", choices = num())  
  })
}

# Run the application 
shinyApp(ui = ui, server = server)

标签: rshiny

解决方案


与参数一起使用selectizeInput而不是。selectInputoptions = list(maxOptions = 3000)


推荐阅读