Spaces:
Sleeping
Sleeping
Update app.R
Browse files
app.R
CHANGED
|
@@ -950,62 +950,57 @@ server <- function(input, output, session) {
|
|
| 950 |
# ============================================================
|
| 951 |
# POPULATE OF PLAYER DROPDOWN
|
| 952 |
# ============================================================
|
| 953 |
-
|
| 954 |
-
|
| 955 |
-
|
| 956 |
-
|
| 957 |
-
|
| 958 |
-
|
| 959 |
-
|
| 960 |
-
|
| 961 |
-
|
| 962 |
-
|
| 963 |
-
|
| 964 |
-
|
| 965 |
-
selected = if (length(players) > 0) players[1] else NULL)
|
| 966 |
-
})
|
| 967 |
|
| 968 |
# ============================================================
|
| 969 |
# POPULATE IF PLAYER DROPDOWN
|
| 970 |
# ============================================================
|
| 971 |
-
|
| 972 |
-
|
| 973 |
-
|
| 974 |
-
|
| 975 |
-
|
| 976 |
-
|
| 977 |
-
|
| 978 |
-
|
| 979 |
-
|
| 980 |
-
|
| 981 |
-
|
| 982 |
-
|
| 983 |
-
selected = if (length(players) > 0) players[1] else NULL)
|
| 984 |
-
})
|
| 985 |
|
| 986 |
# ============================================================
|
| 987 |
# POPULATE DEFENSIVE POSITIONING DROPDOWNS
|
| 988 |
# ============================================================
|
| 989 |
-
|
| 990 |
-
|
| 991 |
-
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
})
|
| 995 |
|
| 996 |
-
|
| 997 |
-
|
| 998 |
-
|
| 999 |
-
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
| 1003 |
-
|
| 1004 |
-
|
| 1005 |
-
|
| 1006 |
-
|
| 1007 |
-
|
| 1008 |
-
})
|
| 1009 |
|
| 1010 |
# ============================================================
|
| 1011 |
# OUTFIELD OAA OUTPUTS
|
|
|
|
| 950 |
# ============================================================
|
| 951 |
# POPULATE OF PLAYER DROPDOWN
|
| 952 |
# ============================================================
|
| 953 |
+
observeEvent(list(authed(), input$of_year_select, input$of_position), {
|
| 954 |
+
req(isTRUE(authed()), input$of_year_select, input$of_position)
|
| 955 |
+
d <- of_data()
|
| 956 |
+
pos <- input$of_position
|
| 957 |
+
if (pos %in% c("LF","CF","RF")) {
|
| 958 |
+
players <- sort(unique(d$obs_player[d$hit_location == pos]))
|
| 959 |
+
} else {
|
| 960 |
+
players <- sort(unique(d$obs_player))
|
| 961 |
+
}
|
| 962 |
+
updateSelectInput(session, "of_player", choices = players,
|
| 963 |
+
selected = if (length(players) > 0) players[1] else NULL)
|
| 964 |
+
}, ignoreInit = TRUE)
|
|
|
|
|
|
|
| 965 |
|
| 966 |
# ============================================================
|
| 967 |
# POPULATE IF PLAYER DROPDOWN
|
| 968 |
# ============================================================
|
| 969 |
+
observeEvent(list(authed(), input$if_year_select, input$if_position), {
|
| 970 |
+
req(isTRUE(authed()), input$if_year_select, input$if_position)
|
| 971 |
+
d <- if_data()
|
| 972 |
+
pos <- input$if_position
|
| 973 |
+
if (pos %in% c("SS","2B","3B","1B")) {
|
| 974 |
+
players <- sort(unique(d$obs_player_name[d$obs_player == pos]))
|
| 975 |
+
} else {
|
| 976 |
+
players <- sort(unique(d$obs_player_name))
|
| 977 |
+
}
|
| 978 |
+
updateSelectInput(session, "if_player", choices = players,
|
| 979 |
+
selected = if (length(players) > 0) players[1] else NULL)
|
| 980 |
+
}, ignoreInit = TRUE)
|
|
|
|
|
|
|
| 981 |
|
| 982 |
# ============================================================
|
| 983 |
# POPULATE DEFENSIVE POSITIONING DROPDOWNS
|
| 984 |
# ============================================================
|
| 985 |
+
observeEvent(authed(), {
|
| 986 |
+
req(isTRUE(authed()))
|
| 987 |
+
teams <- sort(unique(def_pos_data$PitcherTeam))
|
| 988 |
+
updateSelectInput(session, "dp_team", choices = teams,
|
| 989 |
+
selected = if ("CCU_CHN" %in% teams) "CCU_CHN" else teams[1])
|
| 990 |
+
}, ignoreInit = TRUE)
|
| 991 |
|
| 992 |
+
observeEvent(list(authed(), input$dp_team), {
|
| 993 |
+
req(isTRUE(authed()), input$dp_team)
|
| 994 |
+
td <- def_pos_data %>% filter(PitcherTeam == input$dp_team)
|
| 995 |
+
pitchers <- sort(unique(td$Pitcher))
|
| 996 |
+
batters <- sort(unique(td$Batter))
|
| 997 |
+
opponents <- sort(unique(td$BatterTeam))
|
| 998 |
+
counts <- sort(unique(td$pitch_count))
|
| 999 |
+
updateSelectInput(session, "dp_pitcher", choices = c("No Filter", pitchers))
|
| 1000 |
+
updateSelectInput(session, "dp_hitter", choices = c("No Filter", batters))
|
| 1001 |
+
updateSelectInput(session, "dp_opponent", choices = c("No Filter", opponents))
|
| 1002 |
+
updateSelectInput(session, "dp_count", choices = c("No Filter", counts))
|
| 1003 |
+
}, ignoreInit = TRUE)
|
|
|
|
| 1004 |
|
| 1005 |
# ============================================================
|
| 1006 |
# OUTFIELD OAA OUTPUTS
|