25

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.

0

1 Answer 1

52

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" 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.