我想要兩個不同的事件來觸發我的應用程序中各種繪圖/輸出所使用的數據的更新。一個是被單擊的按鈕(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 } })但是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子句使用某種動作組合功能嗎?
3 回答

交互式愛情
TA貢獻1712條經驗 獲得超3個贊
我已經通過創建反應式對象并將其用于事件更改表達式中來解決了此問題。如下:
xxchange <- reactive({
paste(input$filter , input$term)
})
output$mypotput <- eventReactive( xxchange(), {
...
...
...
} )
- 3 回答
- 0 關注
- 703 瀏覽
添加回答
舉報
0/150
提交
取消