Boa tarde!
Estou com uma dúvida sobre um filtro do shiny.
Quero fazer dois filtros hierárquicos, porém com múltiplas escolhas. Não estou conseguindo fazê-lo, pois está dando erro. Conseguem me ajudar? Vou anotar o código abaixo:
ui <- dashboardPage(
dashboardHeader(title = "Dash"),
dashboardSidebar(),
dashboardBody(
fluidRow(
#filtro Area
box(
width = 3,
height = 80,
pickerInput(
inputId = "selec_area",
label = "Selecione a Área",
choices = "",
selected = "",
multiple = TRUE)),
# filtro Lider
box(
width = 3,
height = 80,
pickerInput(
inputId = "selec_lider",
label = "Selecione o Líder",
choices = ""))
)
#### server ####
server <- function(input, output, session) {
#### output area ####
output$selec_area <- renderUI({
areas <- df$Area %>%
unique() %>%
sort()
pickerInput(
inputId = "selec_area",
label = "Selecione a area",
choices = areas,
selected = areas,
multiple = TRUE
)
})
observe({
areas <- df$Area %>%
unique() %>%
sort()
updatePickerInput(
session,
inputId = "selec_area",
choices = areas
)
})
#### update lider ####
observe({
lideres <- df %>%
filter(Area == input$selec_area) %>%
pull(Gestor_Imediato)
updatePickerInput(
session,
inputId = "selec_lider",
choices = lideres
)
})
}
Agradeço desde já!