igroffman commited on
Commit
5a5be03
·
verified ·
1 Parent(s): 17a1068

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +6 -7
app.R CHANGED
@@ -2237,15 +2237,14 @@ catcher_create_catcher_pdf <- function(game_df, catcher_name, output_file, bio_d
2237
  `CCU Game +/-` = sum(StolenStrike, na.rm = TRUE) - sum(StrikeLost, na.rm = TRUE),
2238
  .groups = "drop")
2239
 
2240
- # Dynamically find the opponent BatterTeam ID (not CCU)
2241
- opp_batter_team_id <- game_df %>%
2242
- filter(PitcherTeam == "COA_CHA") %>%
2243
- pull(BatterTeam) %>%
2244
  na.omit() %>%
2245
- { names(sort(table(.), decreasing=TRUE))[1] }
2246
 
2247
- opp_receiving_stats <- catcher_df %>%
2248
- filter(BatterTeam == opp_batter_team_id) %>%
2249
  summarise(
2250
  `Opp Strikes Stolen` = sum(StolenStrike, na.rm = TRUE),
2251
  `Opp Strikes Lost` = sum(StrikeLost, na.rm = TRUE),
 
2237
  `CCU Game +/-` = sum(StolenStrike, na.rm = TRUE) - sum(StrikeLost, na.rm = TRUE),
2238
  .groups = "drop")
2239
 
2240
+ opp_catcher_name <- game_df %>%
2241
+ filter(CatcherTeam != "COA_CHA") %>%
2242
+ pull(Catcher) %>%
 
2243
  na.omit() %>%
2244
+ { names(sort(table(.), decreasing = TRUE))[1] }
2245
 
2246
+ opp_receiving_stats <- game_df %>%
2247
+ filter(Catcher == opp_catcher_name) %>%
2248
  summarise(
2249
  `Opp Strikes Stolen` = sum(StolenStrike, na.rm = TRUE),
2250
  `Opp Strikes Lost` = sum(StrikeLost, na.rm = TRUE),