Spaces:
Sleeping
Sleeping
Update app.R
Browse files
app.R
CHANGED
|
@@ -158,7 +158,6 @@ IF_OAA_25 <- download_private_parquet("CoastalBaseball/DefenseAppDataset", "IF_O
|
|
| 158 |
|
| 159 |
if ("obs_player_bearing_diff" %in% names(IF_OAA_25)) {
|
| 160 |
IF_OAA_25$obs_player_direction_diff <- IF_OAA_25$obs_player_bearing_diff
|
| 161 |
-
IF_OAA_25 <- IF_OAA_25 %>% dplyr::select(-obs_player_bearing_diff)
|
| 162 |
}
|
| 163 |
|
| 164 |
OF_OAA_25 <- as.data.frame(download_private_parquet("CoastalBaseball/DefenseAppDataset", "CC_OAA25.parquet")) %>%
|
|
@@ -347,6 +346,7 @@ if_oaa_setup <- function(data) {
|
|
| 347 |
obs_player_bearing = case_when(obs_player=="1B"~bearing_1b,obs_player=="2B"~bearing_2b,
|
| 348 |
obs_player=="3B"~bearing_3b,obs_player=="SS"~bearing_ss),
|
| 349 |
obs_player_direction_diff = obs_player_bearing - Direction,
|
|
|
|
| 350 |
dist_from_first = sqrt((obs_player_z - 63.64)^2 + (obs_player_x + 63.64)^2),
|
| 351 |
dist_from_second = sqrt((obs_player_z)^2 + (obs_player_x - 127.28)^2),
|
| 352 |
dist_from_third = sqrt((obs_player_z + 63.64)^2 + (obs_player_x - 63.64)^2),
|
|
@@ -374,7 +374,8 @@ if_oaa_setup <- function(data) {
|
|
| 374 |
play_pred = ifelse(play_prob >= .5, 1, 0),
|
| 375 |
OAA = (as.numeric(success_ind)) - play_prob) %>%
|
| 376 |
dplyr::select(obs_player_name, obs_player, success_ind, play_prob, play_pred, OAA,
|
| 377 |
-
obs_player_direction_diff,
|
|
|
|
| 378 |
HangTime, Distance, Bearing, Direction, ExitSpeed, Angle,
|
| 379 |
dist_from_lead_base, player_angle_rad,
|
| 380 |
Date, Pitcher, Inning, Batter, HomeTeam, AwayTeam,
|
|
|
|
| 158 |
|
| 159 |
if ("obs_player_bearing_diff" %in% names(IF_OAA_25)) {
|
| 160 |
IF_OAA_25$obs_player_direction_diff <- IF_OAA_25$obs_player_bearing_diff
|
|
|
|
| 161 |
}
|
| 162 |
|
| 163 |
OF_OAA_25 <- as.data.frame(download_private_parquet("CoastalBaseball/DefenseAppDataset", "CC_OAA25.parquet")) %>%
|
|
|
|
| 346 |
obs_player_bearing = case_when(obs_player=="1B"~bearing_1b,obs_player=="2B"~bearing_2b,
|
| 347 |
obs_player=="3B"~bearing_3b,obs_player=="SS"~bearing_ss),
|
| 348 |
obs_player_direction_diff = obs_player_bearing - Direction,
|
| 349 |
+
obs_player_bearing_diff = obs_player_direction_diff
|
| 350 |
dist_from_first = sqrt((obs_player_z - 63.64)^2 + (obs_player_x + 63.64)^2),
|
| 351 |
dist_from_second = sqrt((obs_player_z)^2 + (obs_player_x - 127.28)^2),
|
| 352 |
dist_from_third = sqrt((obs_player_z + 63.64)^2 + (obs_player_x - 63.64)^2),
|
|
|
|
| 374 |
play_pred = ifelse(play_prob >= .5, 1, 0),
|
| 375 |
OAA = (as.numeric(success_ind)) - play_prob) %>%
|
| 376 |
dplyr::select(obs_player_name, obs_player, success_ind, play_prob, play_pred, OAA,
|
| 377 |
+
obs_player_direction_diff, obs_player_direction_diff, obs_player_bearing,
|
| 378 |
+
obs_player_x, obs_player_z,
|
| 379 |
HangTime, Distance, Bearing, Direction, ExitSpeed, Angle,
|
| 380 |
dist_from_lead_base, player_angle_rad,
|
| 381 |
Date, Pitcher, Inning, Batter, HomeTeam, AwayTeam,
|