我希望两个不同的事件触发我的应用程序中各种绘图/输出使用的数据更新.一个是被点击的按钮(input$spec_button
),另一个是被点击的点上的点(mainplot.click$click
).
基本上,我想同时列出这两种代码,但我不确定如何编写代码.以下是我现在拥有的:
在服务器中.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
}
})
但是if-else条款不起作用
Error in mainplot.click$click | input$spec_button :
operations are possible only for numeric, logical or complex types
--> Is there some sort of action-combiner function I can use for the mainplot.click$click | input$spec_button
clause?