在 Shiny 中的 conditionalPanel 中添加多个条件 [英] Adding multiple conditions in conditionalPanel in Shiny

查看:27
本文介绍了在 Shiny 中的 conditionalPanel 中添加多个条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否可以在 conditionalPanel 中添加多个条件.这是一个例子:

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))

我想添加另一个条件(除了input.SELECT==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))

但是没有用.如果有人能以正确的方式在上面的 conditionalPanel 中包含多个条件,我将不胜感激.

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.

推荐答案

只要语句最后的计算结果为 TRUE 或 FALSE,您就可以拥有任意复杂的语句.您可能希望将您的两个条件与 AND && 或 OR || 结合起来,就像这样(对于 OR):

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" 

这篇关于在 Shiny 中的 conditionalPanel 中添加多个条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆