r - 我可以通过在 Shiny 中更改 selectInput 的状态来触发 eventReactive 吗?
问题描述
您能否举个例子来帮助我如何触发 eventReactive 表达式以通过“动作按钮”或通过从 selectInput 中选择另一个项目(而不是默认值)来启动,例如:
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()
,并将它们作为表达式传递给 in 的第一个参数eventReactive()
,如下所示:
DAT<-eventReactive({ c(input$action_button,input$sel_input_menu) },{
# do some stuff
})
推荐阅读
- python - 通过经过身份验证的用户 id 获取人员 id
- c++ - 查找名称的最直接声明的名称查找规则在哪里定义?
- c++ - 空对象正在调用一个方法,但程序没有崩溃……如何……为什么?
- vba - 扫雷的 VBA 随机地雷生成
- javascript - 循环遍历对象数组时调用方法
- pm2 - PM2 能否对标记为“错误”的进程采取措施
- android - 如何使用设备的加速度计检测运动增加然后突然停止?
- eigen - 对包含固定大小的 Eigen 类型的结构使用默认的 Eigen::aligned_allocator 是否危险?
- ms-access - 在 Access VBA 中抓取项目并将其从一种形式返回到另一种形式
- ios - Swift 在 UITableViewCells 中保留 UISegmentedControl 值