微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

条件面板中的javascript条件:javascript中%运算符中是否存在R%?

我正在尝试使用闪亮包中的conditionalPanel函数构建一个闪亮的应用程序.条件应该用 JavaScript编写,但我希望能够使用如下条件(用R编写)
"TP53" %in% unlist(input$ModelVariables)

文件说明:

condition –
A JavaScript expression that will be evaluated repeatedly to determine whether the panel should be displayed.

我根本不熟悉JavaScript.我尝试过input.ModelVariables ==’TP53’但是当input.ModelVariables的长度大于1时,这不起作用.

我的sidebarPanel片段与conditionalPanel在下面

checkBoxGroupInput("ModelVariables",label = h3("Which variables to view?"),choices = list( "cohort","stage","therapy","TP53","MDM2" ),selected = list("TP53")
                                  ),conditionalPanel(condition = "'TP53' in unlist(input.ModelVariables)",checkBoxGroupInput("ModelVariablesTP53",label = h3("Which mutations to view?"),choices = list( "Missense","Other","WILD"),selected = list("Missense","WILD")
                                                        )

解决方法

根据 this answer这个条件应该工作(它适用于我)

condition =“input.ModelVariables.indexOf(‘TP53’)> -1”

原文地址:https://www.jb51.cc/js/150459.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐