首页 > 解决方案 > Rshiny:减少从所有组件的选定下拉列表中过滤 df 的处理时间

问题描述

我的仪表板有多个组件/图表,所有组件都将经历相同的过滤过程,并根据我的下拉选择选择正确的 df。有什么方法可以通过只对所有组件运行一次此过滤过程来减少该过程。

以下是过滤示例:

if(input$comp_region == "USA"){
  txn_df <- usa_df
}else if(input$comp_region == "Australia"){
  txn_df <- aus_df
}else{
  txn_df <- jpn_df
}

txn_df <- txn_df %>% 
  filter(user_type %in% input$user) %>% 
  filter(date == input$time) %>% 

标签: rshiny

解决方案


推荐阅读