This is an extension of the question asked here: R shiny Multiple slider inputs based on checkbox inputs. The issue I have is that my checkbox "One" should open sliders 1 and 2 and checkbox "Three" should open sliders 1 and 3. If I check "One" and "Three" I am getting slider 1 twice :(. Similarly, checking "One" and "Two" opening slider 2 twice :(. Expected behavior would be that only one slider is being used. My apologies in advance if this is trivial!
library(shiny)
myData = c("One", "Two", "Three")
ui <- fluidPage(
checkboxGroupInput("choosemedia", "Choose digital",
choices = myData,
selected = myData),
textOutput("myText"),
conditionalPanel(condition = "input.choosemedia.includes('One')",
sliderInput("sliderOne", "Choose value no 1",
min=0, max=100, value=50),
sliderInput("sliderTwo", "Choose value no 2",
min=0, max=50, value=25)),
conditionalPanel(condition = "input.choosemedia.includes('Two')",
sliderInput("sliderTwo", "Choose value no 2",
min=0, max=50, value=25)),
conditionalPanel(condition = "input.choosemedia.includes('Three')",
sliderInput("sliderOne", "Choose value no 1",
min=0, max=50, value=25),
sliderInput("sliderThree", "Choose value no 3",
min=0, max=50, value=25))
)
# Define server logic
server <- function(input, output) {
output$myText <- renderText({input$choosemedia})
}
# Run the application
shinyApp(ui = ui, server = server)
Any suggestion will be grately appreciated.
Aucun commentaire:
Enregistrer un commentaire