igroffman commited on
Commit
ccc530e
·
verified ·
1 Parent(s): 6351846

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +17 -0
app.R CHANGED
@@ -1175,6 +1175,15 @@ app_ui <- fluidPage(
1175
  choices = c("CSV" = "csv", "Parquet" = "parquet"),
1176
  selected = "csv", inline = TRUE)
1177
  ),
 
 
 
 
 
 
 
 
 
1178
  column(4,
1179
  br(),
1180
  downloadButton("downloadData", "Download", class = "btn-success btn-lg")
@@ -2533,6 +2542,14 @@ server <- function(input, output, session) {
2533
  df$Notes[last_row] <- paste(existing, unmatched_str, sep = " | ")
2534
  }
2535
  }
 
 
 
 
 
 
 
 
2536
 
2537
  return(df)
2538
  }
 
1175
  choices = c("CSV" = "csv", "Parquet" = "parquet"),
1176
  selected = "csv", inline = TRUE)
1177
  ),
1178
+ hr(),
1179
+ radioButtons("download_team_filter", "Team Filter:",
1180
+ choices = c(
1181
+ "All Data" = "all",
1182
+ "Coastal Pitchers Only (PitcherTeam = COA_CHA)" = "coastal_pitchers",
1183
+ "Coastal Hitters Only (BatterTeam = COA_CHA)" = "coastal_hitters"
1184
+ ),
1185
+ selected = "all"),
1186
+ hr(),
1187
  column(4,
1188
  br(),
1189
  downloadButton("downloadData", "Download", class = "btn-success btn-lg")
 
2542
  df$Notes[last_row] <- paste(existing, unmatched_str, sep = " | ")
2543
  }
2544
  }
2545
+
2546
+ if (!is.null(input$download_team_filter) && input$download_team_filter != "all") {
2547
+ if (input$download_team_filter == "coastal_pitchers" && "PitcherTeam" %in% names(df)) {
2548
+ df <- df %>% filter(PitcherTeam == "COA_CHA")
2549
+ } else if (input$download_team_filter == "coastal_hitters" && "BatterTeam" %in% names(df)) {
2550
+ df <- df %>% filter(BatterTeam == "COA_CHA")
2551
+ }
2552
+ }
2553
 
2554
  return(df)
2555
  }