有没有办法在 ShinyWidgets 中使用 selectizeGroup 向这个示例添加选项组?我想要这样的东西:https ://shiny.rstudio.com/gallery/option-groups-for-selectize-input.html ?
例如,将制造商列表分为“Toyota and subaru”和“Rest”?
library(shiny)
library(shinyWidgets)
data("mpg", package = "ggplot2")
ui <- fluidPage(
fluidRow(
column(
width = 10, offset = 1,
tags$h3("Filter data with selectize group"),
panel(
selectizeGroupUI(
id = "my-filters",
params = list(
manufacturer = list(inputId = "manufacturer", title = "Manufacturer:"),
model = list(inputId = "model", title = "Model:"),
trans = list(inputId = "trans", title = "Trans:"),
class = list(inputId = "class", title = "Class:")
)
), status = "primary"
),
DT::dataTableOutput(outputId = "table")
)
)
)
server <- function(input, output, session) {
res_mod <- callModule(
module = selectizeGroupServer,
id = "my-filters",
data = mpg,
vars = c("manufacturer", "model", "trans", "class")
)
output$table <- DT::renderDataTable(res_mod())
}
shinyApp(ui, server)