为 SelectizeInput 函数链接闪亮的侧边栏面板
Linking sidebarPanels in shiny for SelectizeInput function
假设我在 sidebarPanel - location
中有一个下拉列表,我可以从中 select 最多 2 个选项。我想创建一个 if 循环,其中 - 从下拉列表中选择 'Saddle Joint' 和 'Gliding Joint' 导致 selection of objects 'x' and 'y' in another sidebarPanel - datasets
- 基本上创建了一个链接。
我试过这段代码,但它不起作用:
if (input$location== "Saddle Joint" & input$location== "Gliding Joint") {
updateCheckboxGroupInput(session,
"datasets", "Datasets:", choices = c("x","y"),
selected= c("x","y"))
}
请查看屏幕截图以获得更好的图片!
谢谢!
问题出在您的 if
语句中的布尔值上。使用这个:
"Saddle Joint" %in% input$location & "Gliding Joint" %in% input$location
也可以使用:
all(c("Saddle Joint","Gliding Joint") %in% input$location)
假设我在 sidebarPanel - location
中有一个下拉列表,我可以从中 select 最多 2 个选项。我想创建一个 if 循环,其中 - 从下拉列表中选择 'Saddle Joint' 和 'Gliding Joint' 导致 selection of objects 'x' and 'y' in another sidebarPanel - datasets
- 基本上创建了一个链接。
我试过这段代码,但它不起作用:
if (input$location== "Saddle Joint" & input$location== "Gliding Joint") {
updateCheckboxGroupInput(session,
"datasets", "Datasets:", choices = c("x","y"),
selected= c("x","y"))
}
请查看屏幕截图以获得更好的图片!
谢谢!
问题出在您的 if
语句中的布尔值上。使用这个:
"Saddle Joint" %in% input$location & "Gliding Joint" %in% input$location
也可以使用:
all(c("Saddle Joint","Gliding Joint") %in% input$location)