相关疑难解决方法(0)

如何在Shiny eventReactive处理程序中侦听多个事件表达式

我想要两个不同的事件来触发我的应用程序中各种图表/输出所使用的数据的更新.一个是单击按钮(input$spec_button),另一个是点击点上的点(mainplot.click$click).

基本上,我想同时列出两者,但我不知道如何编写代码.这就是我现在拥有的:

在server.R中:

data <- eventReactive({mainplot.click$click | input$spec_button}, {
    if(input$spec_button){
      # get data relevant to the button
    } else {
      # get data relevant to the point clicked
    }
  })
Run Code Online (Sandbox Code Playgroud)

但if-else子句不起作用

Error in mainplot.click$click | input$spec_button : operations are possible only for numeric, logical or complex types

- >我可以使用某种动作组合器功能用于该mainplot.click$click | input$spec_button子句吗?

r shiny

74
推荐指数
5
解决办法
3万
查看次数

标签 统计

r ×1

shiny ×1