conditionalPanel
is what you want. http://rstudio.github.com/shiny/tutorial/#dynamic-ui
selectInput("variable", "Variable:",
list(""Cylinders" = "cyl",
"Transmission" = "am"),
conditionalPanel(condition = "input.variable == 'am'",
sliderInput("integer", "Integer:",
min=0, max=1, value=0)),
conditionalPanel(condition = "input.variable == 'cyl'",
sliderInput("decimal", "Decimal:",
min = 0, max = 1, value = 1))
(I haven't actually tried to run this code but you should be able to get the idea)
Note that conditionalPanel just hides the control, the child control still exists whether it is showing or not. In your server logic, you'll have to use if (input$variable == 'am')
to see what your mode you're in (which is probably the natural way anyway) rather than testing for the existence of input$integer
or input$decimal
.