Spaces:
Running
Running
Update R/visualization_functions.R
Browse files
R/visualization_functions.R
CHANGED
|
@@ -36,7 +36,7 @@ hitter_percentiles <- function(df, batter, season = NULL) {
|
|
| 36 |
|
| 37 |
season_summary_df <- hitter_stats %>%
|
| 38 |
{ if (!is.null(season)) dplyr::filter(., Season == season) else . } %>%
|
| 39 |
-
dplyr::filter(PA >=
|
| 40 |
dplyr::transmute(
|
| 41 |
xwOBA = xwOBA,
|
| 42 |
xBA = xBA,
|
|
@@ -331,7 +331,7 @@ value_percentiles <- function(hit_war, batter, season) {
|
|
| 331 |
return(blank_percentile_plot("Value"))
|
| 332 |
}
|
| 333 |
|
| 334 |
-
hit_comp_idx <- season_hit_war$PA >=
|
| 335 |
if (!any(hit_comp_idx, na.rm = TRUE)) hit_comp_idx <- season_hit_war$PA >= 50
|
| 336 |
if (!any(hit_comp_idx, na.rm = TRUE)) hit_comp_idx <- season_hit_war$PA >= 25
|
| 337 |
if (!any(hit_comp_idx, na.rm = TRUE)) hit_comp_idx <- !is.na(season_hit_war$PA)
|
|
@@ -1646,13 +1646,13 @@ value_percentiles_pitcher <- function(pitcher, pit_war, df, season) {
|
|
| 1646 |
pitcher_split <- cbind(pitcher_split, pitch_split_pitches)
|
| 1647 |
|
| 1648 |
season_pitcher_stuff <- pitcher_stats %>%
|
| 1649 |
-
dplyr::filter(Season == season
|
| 1650 |
|
| 1651 |
if (nrow(season_pitcher_stuff) == 0) {
|
| 1652 |
return(blank_percentile_plot("Value"))
|
| 1653 |
}
|
| 1654 |
|
| 1655 |
-
pit_comp_idx <- season_pit_war$IP >=
|
| 1656 |
if (!any(pit_comp_idx, na.rm = TRUE)) pit_comp_idx <- season_pit_war$IP >= 10
|
| 1657 |
if (!any(pit_comp_idx, na.rm = TRUE)) pit_comp_idx <- season_pit_war$IP >= 5
|
| 1658 |
if (!any(pit_comp_idx, na.rm = TRUE)) pit_comp_idx <- !is.na(season_pit_war$IP)
|
|
|
|
| 36 |
|
| 37 |
season_summary_df <- hitter_stats %>%
|
| 38 |
{ if (!is.null(season)) dplyr::filter(., Season == season) else . } %>%
|
| 39 |
+
dplyr::filter(PA >= 5) %>%
|
| 40 |
dplyr::transmute(
|
| 41 |
xwOBA = xwOBA,
|
| 42 |
xBA = xBA,
|
|
|
|
| 331 |
return(blank_percentile_plot("Value"))
|
| 332 |
}
|
| 333 |
|
| 334 |
+
hit_comp_idx <- season_hit_war$PA >= 5
|
| 335 |
if (!any(hit_comp_idx, na.rm = TRUE)) hit_comp_idx <- season_hit_war$PA >= 50
|
| 336 |
if (!any(hit_comp_idx, na.rm = TRUE)) hit_comp_idx <- season_hit_war$PA >= 25
|
| 337 |
if (!any(hit_comp_idx, na.rm = TRUE)) hit_comp_idx <- !is.na(season_hit_war$PA)
|
|
|
|
| 1646 |
pitcher_split <- cbind(pitcher_split, pitch_split_pitches)
|
| 1647 |
|
| 1648 |
season_pitcher_stuff <- pitcher_stats %>%
|
| 1649 |
+
dplyr::filter(Season == season)
|
| 1650 |
|
| 1651 |
if (nrow(season_pitcher_stuff) == 0) {
|
| 1652 |
return(blank_percentile_plot("Value"))
|
| 1653 |
}
|
| 1654 |
|
| 1655 |
+
pit_comp_idx <- season_pit_war$IP >= 3
|
| 1656 |
if (!any(pit_comp_idx, na.rm = TRUE)) pit_comp_idx <- season_pit_war$IP >= 10
|
| 1657 |
if (!any(pit_comp_idx, na.rm = TRUE)) pit_comp_idx <- season_pit_war$IP >= 5
|
| 1658 |
if (!any(pit_comp_idx, na.rm = TRUE)) pit_comp_idx <- !is.na(season_pit_war$IP)
|