I'm new to R and shiny (coming from Python), so please bear with me. Using the example below, I simply want to restrict the options available in the selectizeInput widget based on what is selected from the first widget (the radio buttons). For example, if the radio button option of "A class" is selected, then I want the dropdown box to only show the two "A class" funds: Fund A and Fund B. Conversely, if "B class" is selected, the dropdown should only show funds C & D.
library(shiny)
series_choices = c("A class", "B class")
fund_choices = c("Fund A", "Fund B", "Fund C", "Fund D")
fund_series = c("A class", "A class", "B class", "B class")
# Shiny app ----
ui <- fluidPage(
titlePanel("Fund Comparison"),
sidebarLayout(
# Sidebar panel for inputs ----
sidebarPanel(
# Series selector
radioButtons(inputId = "series_selector",
label = "Series:",
choices = series_choices,
inline=TRUE,
selected = "A class"),
# Fund selector
selectizeInput(inputId = "funds_selector",
label = "Funds:",
choices = fund_choices,
multiple = TRUE),
),
# Main panel for displaying outputs ----
mainPanel(
# [Some charts coming later]
)
)
)
server <- function(input, output) {
}
# Create Shiny app ----
shinyApp(ui, server)