I want to have grouped choices in selectizeInput. This can be done by providing a named list as the argument "choices". However, if a group contains just 1 element, the "grouped display" of the choices doesn't work. I think it interferes with the option to provide named vectors for single arguments. How can I achieve it, that the options are always grouped, even if there happens to be just 1 element in a group?
library(shiny)
shinyApp(
ui = fluidPage(uiOutput("type")),
server = function(input, output, session) {
output$type <- renderUI({
selectizeInput(inputId = "color",
label = "Color",
choices = list(one = c(3,5,2,5,6),
two = c("no", "yes", "no"),
three = "only_option"),
multiple = T)
})
}
)
In the above case, the element "only_option" is wrongly assigned to the group "two".