我想selectInput
按照此处的说明对数据进行分组:https ://shiny.rstudio.com/gallery/option-groups-for-selectize-input.html 。除了组中只有一个项目的情况外,一切正常。
这是一个示例(第一个正确selectInput
,第二个奇怪):
library(shiny)
ui <- fluidPage(
selectInput("country", "Select country", list(
"Europe" = c("Germany", "Spain"),
"North America" = c("Canada", "United States" = "USA")
)),
selectInput("country", "Select country", list(
"Europe" = c("Germany", "Spain"),
"North America" = c("Canada")
))
)
server <- function(input, output, session) {
}
shinyApp(ui = ui, server = server)
以及效果:
你知道如何处理吗?