Hello everyone!! I've been having trouble with making my app dynamic. I want a sliderInput to appear in the UI only if the option Histograma is selected from the selectInput options. I'd really appreciate any help. I attach a simple example below. In this example the sliderInput appears by default, and I want it to display in the app only if the the Histograma option is selected.
library(shiny)
ui <- fluidPage(
br(),
selectInput(inputId = "tipograf", label = "Seleccione el tipo de gráfico",
choices = c("LĂnea", "Box-plot", "Histograma")),
uiOutput("selectBins")
)
server <- function(input, output, session) {
observeEvent("input$tipoGrafico == Histograma", {
output$selectBins <- renderUI({
conditionalPanel(condition = "input.tipograf == Histograma",
sliderInput(inputId = "numBins", label = "Seleccione el nĂşmero de barras",
min = 10, max = 100, value = 20, step = 1))
})
})
}
shinyApp(ui = ui, server = server)