我可以通过改变 Shiny 中 selectInput 的状态来触发 eventReactive 吗?

Can I trigger eventReactive by changing state of selectInput in Shiny?

你能帮忙举例说明我如何通过 "actionbutton" 或从 selectInput 中选择另一个项目(非默认值)来触发 eventReactive 表达式,例如:

DAT<-eventReactive(input$action_button | input$sel_input_menu,{

rest of the code comes here that gets executed whenever I either hit the "actionbutton" or change the state of the selectInput...

})

您需要将两个输入包装在 c() 中并将它们作为表达式传递给 eventReactive() 中的第一个参数,例如:

DAT<-eventReactive({ c(input$action_button,input$sel_input_menu) },{
        # do some stuff
    })