我正在尝试使用闪亮包中的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”