首页 文章

将sidebarPanel链接为闪亮的SelectizeInput函数

提问于
浏览
0

假设我在 sidebarPanel - location 中有一个下拉列表,我可以从中选择最多2个选项 . 我想创建一个if循环,其中从下拉列表选择'Saddle Joint'和'Gliding Joint'导致在另一个'x'中选择对象'x'和'y' - 基本上创建链接 .

我尝试了这段代码,但它不起作用:

if (input$location== "Saddle Joint" & input$location== "Gliding Joint") {

  updateCheckboxGroupInput(session,
                           "datasets", "Datasets:", choices = c("x","y"),
                           selected= c("x","y"))
}

请查看截图以获得更好的图片!

谢谢!

Screenshot

1 回答

  • 0

    问题在于 if 语句中的布尔值 . 用这个:

    "Saddle Joint" %in% input$location & "Gliding Joint" %in% input$location
    

    也可以使用:

    all(c("Saddle Joint","Gliding Joint") %in% input$location)
    

相关问题