Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding multiple conditions in conditionalPanel in Shiny

Tags:

r

rstudio

shiny

I was wondering if it is possible to add more than one condition in conditionalPanel in shiny. This is an example:

 conditionalPanel(condition = "input.SELECT == 1",
                   #Slider 
                   sliderInput("D_FLAG", "Parameter X:",
                   min = 0.001, max = 3, value = 1.38, step = 0.1))

I want to add another condition (other than input.SELECT==1). I have tried this but it didn't work.

conditionalPanel(condition = c("input.SELECT == 1","input.FED==2"),
                   #Slider 
                   sliderInput("D_FLAG", "Parameter X:",
                   min = 0.001, max = 3, value = 1.38, step = 0.1))

but it didn't work. I would appreciate if somebody could have some input on the right way for including multiple conditions in the conditionalPanel above.

like image 533
Amer Avatar asked Nov 02 '15 23:11

Amer


1 Answers

You can have as complicated of a statement as you want as long as it evaluates to TRUE or FALSE at the end. You probably want to combine your two conditions either with AND && or OR ||, like this (for OR):

"input.SELECT == 1 || input.FED == 2" 
like image 104
Gregor Thomas Avatar answered Sep 21 '22 08:09

Gregor Thomas