I have a lot of variables in a dataset that fall into separate categories. If I add a list to the choices
argument in selectInput
, it is too cumbersome to scroll through the choices for each category. Is there any way I can organize the categories across multiple selectInput
boxes? The idea is that the user would be able to select from 1 of the 4 selectInput
boxes for both the x-axis and the y-axis to generate a scatter plot. Or maybe there's a better way to address this problem? I should note that the data is ultra wide (thousands of columns), so my categories are selecting from column names.
Asked
Active
Viewed 221 times
0

user13295525
- 13
- 3
1 Answers
0
Your question is not clear to me but maybe selectizeInput
with the optgroup_columns
plugin is a solution:
library(shiny)
ui <- fluidPage(
br(),
selectizeInput(
"std", "Select the standard",
choices = list(
"C" = list("c89", "c99", "c11"),
"C++" = list("c++03", "c++11", "c++14", "c++17", "c++20")
),
options = list(
plugins = list("optgroup_columns")
)
)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
The group headers are not nice, you can style them with CSS, e.g.
.selectize-dropdown .optgroup>.optgroup-header {
font-size: 15px;
font-weight: bold;
font-style: italic;
color: black;
}

Stéphane Laurent
- 75,186
- 15
- 119
- 225