TimStats commited on
Commit
46ade12
·
verified ·
1 Parent(s): 639ad63

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +26 -4
app.R CHANGED
@@ -541,7 +541,7 @@ fslteamA <- fslid %>%
541
  select(teams_away_team_name) %>%
542
  distinct()
543
 
544
- # AFL Schedule (2023-2025)
545
  sbid <- bind_rows(
546
  mlb_schedule(season = 2023, level_ids = "22"),
547
  mlb_schedule(season = 2024, level_ids = "22"),
@@ -554,6 +554,17 @@ sbid <- bind_rows(
554
  sbteamA <- sbid %>%
555
  select(teams_away_team_name) %>%
556
  distinct()
 
 
 
 
 
 
 
 
 
 
 
557
 
558
  # UI Definition
559
  ui <- fluidPage(
@@ -604,13 +615,13 @@ server <- function(input, output, session) {
604
  # Main application UI (your existing UI)
605
  fluidPage(
606
  theme = bs_theme(version = 5, bootswatch = "flatly"),
607
- titlePanel("202-2025 Daily MLB/AAA/FSL Summary Cards"),
608
  sidebarLayout(
609
  sidebarPanel(
610
  width = 3,
611
  dateInput("date", "Date:"),
612
  selectizeInput("level", "Level:",
613
- c("MLB", "AAA", "FSL","College (Statcast Parks Only)"),
614
  options = list(
615
  placeholder = 'Select a level',
616
  onInitialize = I('function() { this.setValue(""); }')
@@ -667,6 +678,10 @@ server <- function(input, output, session) {
667
  updateSelectizeInput(session, "homeT", "Home Team:", choices = sbteamH[,1])
668
  updateSelectizeInput(session, "awayT", "Away Team:", choices = sbteamA[,1])
669
  }
 
 
 
 
670
  })
671
 
672
  game_data <- reactiveVal()
@@ -706,7 +721,14 @@ server <- function(input, output, session) {
706
  filter(game_number == input$gamenum)
707
  pname <- pitcher_summary(pname[,6], input$date)
708
  }
709
-
 
 
 
 
 
 
 
710
  if(nrow(pname) == 0) {
711
  showNotification("No pitchers found for the selected game.", type = "warning")
712
  } else {
 
541
  select(teams_away_team_name) %>%
542
  distinct()
543
 
544
+ # College Schedule (2023-2025)
545
  sbid <- bind_rows(
546
  mlb_schedule(season = 2023, level_ids = "22"),
547
  mlb_schedule(season = 2024, level_ids = "22"),
 
554
  sbteamA <- sbid %>%
555
  select(teams_away_team_name) %>%
556
  distinct()
557
+ #Select ACL & FCL Statcast Games
558
+ cpxid <- bind_rows(
559
+ mlb_schedule(season = 2025, level_ids = "16")
560
+ ) %>%
561
+ filter(gameday_type == "E" | gameday_type == "P")
562
+ cpxteamH <- cpxid %>%
563
+ select(teams_home_team_name) %>%
564
+ distinct()
565
+ cpxteamA <- cpxid %>%
566
+ select(teams_away_team_name) %>%
567
+ distinct()
568
 
569
  # UI Definition
570
  ui <- fluidPage(
 
615
  # Main application UI (your existing UI)
616
  fluidPage(
617
  theme = bs_theme(version = 5, bootswatch = "flatly"),
618
+ titlePanel("2020-2025 Daily MLB/AAA/FSL Summary Cards"),
619
  sidebarLayout(
620
  sidebarPanel(
621
  width = 3,
622
  dateInput("date", "Date:"),
623
  selectizeInput("level", "Level:",
624
+ c("MLB", "AAA", "FSL","College (Statcast Parks Only)", "Select Complex League Games"),
625
  options = list(
626
  placeholder = 'Select a level',
627
  onInitialize = I('function() { this.setValue(""); }')
 
678
  updateSelectizeInput(session, "homeT", "Home Team:", choices = sbteamH[,1])
679
  updateSelectizeInput(session, "awayT", "Away Team:", choices = sbteamA[,1])
680
  }
681
+ if(input$level == "Select Complex League Games"){
682
+ updateSelectizeInput(session, "homeT", "Home Team:", choices = cpxteamH[,1])
683
+ updateSelectizeInput(session, "awayT", "Away Team:", choices = cpxteamA[,1])
684
+ }
685
  })
686
 
687
  game_data <- reactiveVal()
 
721
  filter(game_number == input$gamenum)
722
  pname <- pitcher_summary(pname[,6], input$date)
723
  }
724
+ if(input$level == "Select Complex League Games"){
725
+ pname <- sbid %>%
726
+ filter(date == input$date) %>%
727
+ filter(teams_home_team_name == input$homeT) %>%
728
+ filter(teams_away_team_name == input$awayT) %>%
729
+ filter(game_number == input$gamenum)
730
+ pname <- pitcher_summary(pname[,6], input$date)
731
+ }
732
  if(nrow(pname) == 0) {
733
  showNotification("No pitchers found for the selected game.", type = "warning")
734
  } else {