# Filter the data for the pitcher Reed Interdonato
Brian_Foley_data <- data %>%
filter(Pitcher == "Interdonato, Reed")
# Create a detailed table for each pitch
detailed_pitch_table <- Brian_Foley_data %>%
select(AutoPitchType, RelSpeed, SpinRate, SpinAxis, HorzBreak, InducedVertBreak, PitchCall, RelHeight, RelSide, Extension) %>%
rename(
ReleaseSpeed = RelSpeed,
Tilt = SpinAxis,
HorizontalBreak = HorzBreak,
InducedVerticalBreak = InducedVertBreak,
ReleaseHeight = RelHeight,
ReleaseSide = RelSide
) %>%
mutate(
ReleaseSpeed = round(ReleaseSpeed, 2),
SpinRate = round(SpinRate, 2),
Tilt = round(Tilt, 2),
HorizontalBreak = round(HorizontalBreak, 2),
InducedVerticalBreak = round(InducedVerticalBreak, 2),
ReleaseHeight = round(ReleaseHeight, 2),
ReleaseSide = round(ReleaseSide, 2),
Extension = round(Extension, 2),
ClockTilt = round((Tilt / 30) %% 12, 1) # Interpret Tilt as clock face
)
# Display the detailed table
knitr::kable(detailed_pitch_table, caption = "Detailed Pitch Table for Reed Interdonato")
Detailed Pitch Table for Reed Interdonato
Sinker |
91.56 |
2349.77 |
233.18 |
21.16 |
17.08 |
BallCalled |
5.74 |
2.05 |
6.11 |
7.8 |
Sinker |
90.74 |
2459.28 |
232.15 |
18.54 |
15.69 |
BallCalled |
5.60 |
2.17 |
5.88 |
7.7 |
Four-Seam |
92.49 |
2463.53 |
216.01 |
14.16 |
20.78 |
FoulBallNotFieldable |
5.68 |
2.16 |
5.91 |
7.2 |
Four-Seam |
93.07 |
2338.36 |
223.71 |
17.11 |
19.13 |
StrikeCalled |
5.75 |
2.08 |
5.99 |
7.5 |
Sinker |
93.03 |
2283.33 |
228.52 |
17.19 |
16.41 |
InPlay |
5.78 |
2.01 |
5.99 |
7.6 |
Sinker |
91.79 |
2292.32 |
245.92 |
22.83 |
11.37 |
StrikeCalled |
5.43 |
2.22 |
6.06 |
8.2 |
Sinker |
93.02 |
2283.95 |
241.75 |
22.27 |
13.17 |
InPlay |
5.48 |
2.26 |
5.97 |
8.1 |
Sinker |
90.47 |
2427.29 |
235.07 |
21.60 |
16.45 |
BallCalled |
5.65 |
1.91 |
6.00 |
7.8 |
Sinker |
91.31 |
2406.78 |
224.24 |
18.90 |
20.70 |
FoulBallNotFieldable |
5.72 |
2.13 |
5.80 |
7.5 |
Slider |
82.39 |
2224.77 |
39.01 |
-2.95 |
-2.32 |
BallCalled |
5.46 |
2.23 |
5.54 |
1.3 |
Four-Seam |
92.12 |
2477.27 |
224.07 |
16.33 |
17.98 |
BallCalled |
5.73 |
2.05 |
6.09 |
7.5 |
Sinker |
90.51 |
2351.36 |
228.95 |
17.03 |
15.97 |
BallCalled |
5.78 |
2.05 |
5.91 |
7.6 |
Sinker |
92.14 |
2266.47 |
233.29 |
18.89 |
15.22 |
InPlay |
5.55 |
2.24 |
6.29 |
7.8 |
Slider |
83.38 |
2281.82 |
315.76 |
1.97 |
-0.72 |
StrikeSwinging |
5.48 |
2.26 |
5.68 |
10.5 |
Slider |
85.79 |
2305.55 |
120.18 |
-1.95 |
2.27 |
BallCalled |
5.53 |
2.21 |
5.36 |
4.0 |
Sinker |
93.35 |
2351.05 |
232.16 |
19.51 |
16.36 |
BallCalled |
5.89 |
1.96 |
6.16 |
7.7 |
Slider |
83.97 |
2251.54 |
339.49 |
0.25 |
0.51 |
FoulBallNotFieldable |
5.41 |
2.23 |
5.61 |
11.3 |
Four-Seam |
93.67 |
2316.26 |
214.61 |
12.84 |
19.68 |
StrikeSwinging |
5.80 |
2.07 |
6.39 |
7.2 |
# Calculate the total number of pitches
total_pitches <- nrow(detailed_pitch_table)
# Create a summary table
pitch_summary <- detailed_pitch_table %>%
group_by(AutoPitchType) %>%
summarise(
TotalPitches = n(),
Usage = sprintf("%.2f%%", n() / total_pitches * 100),
Balls = sum(PitchCall %in% c("BallCalled", "BallinDirt")),
Strikes = sum(!PitchCall %in% c("BallCalled", "BallinDirt")), # Count everything not a ball as a strike
BallPercentage = sprintf('%.2f%%', Balls / TotalPitches * 100),
StrikePercentage = sprintf('%.2f%%', Strikes / TotalPitches * 100),
AvgVelocity = round(mean(ReleaseSpeed, na.rm = TRUE), 2),
AvgSpinRate = round(mean(SpinRate, na.rm = TRUE), 2),
AvgInducedVertBreak = round(mean(InducedVerticalBreak, na.rm = TRUE), 2),
AvgHorzBreak = round(mean(HorizontalBreak, na.rm = TRUE), 2),
AvgTilt = round(mean(Tilt, na.rm = TRUE), 2),
AvgClockTilt = round(mean(ClockTilt, na.rm = TRUE), 1), # Clock face interpretation
AvgReleaseHeight = round(mean(ReleaseHeight, na.rm = TRUE), 2),
AvgReleaseSide = round(mean(ReleaseSide, na.rm = TRUE), 2),
AvgExtension = round(mean(Extension, na.rm = TRUE), 2)
) %>%
select(AutoPitchType, Usage, everything())
# Display the total number of pitches
cat("Total number of pitches thrown: ", total_pitches, "\n")
## Total number of pitches thrown: 18
# Display the summary table
knitr::kable(pitch_summary, caption = "Summary Pitch Table for Reed Interdonato")
Summary Pitch Table for Reed Interdonato
Four-Seam |
22.22% |
4 |
1 |
3 |
25.00% |
75.00% |
92.84 |
2398.86 |
19.39 |
15.11 |
219.60 |
7.3 |
5.74 |
2.09 |
6.10 |
Sinker |
55.56% |
10 |
5 |
5 |
50.00% |
50.00% |
91.79 |
2347.16 |
15.84 |
19.79 |
233.52 |
7.8 |
5.66 |
2.10 |
6.02 |
Slider |
22.22% |
4 |
2 |
2 |
50.00% |
50.00% |
83.88 |
2265.92 |
-0.06 |
-0.67 |
203.61 |
6.8 |
5.47 |
2.23 |
5.55 |
# Calculate maximum fastball velocity
max_fb_velocity <- detailed_pitch_table %>%
filter(AutoPitchType %in% c("Four-Seam", "Sinker", "Cutter")) %>%
summarise(MaxFBVelocity = max(ReleaseSpeed, na.rm = TRUE)) %>%
pull(MaxFBVelocity)
# Display the maximum fastball velocity
cat("Reed Interdonato maximum FB velocity: ", max_fb_velocity, "mph\n")
## Reed Interdonato maximum FB velocity: 93.67 mph
# Prepare data for plotting pitch locations
pitch_location_data <- Brian_Foley_data %>%
select(AutoPitchType, PlateLocHeight, PlateLocSide, PitchCall) %>%
rename(
PitchHeight = PlateLocHeight,
PitchSide = PlateLocSide
) %>%
mutate(
SwingTake = ifelse(PitchCall %in% c("StrikeSwinging", "FoulBall", "FoulBallFieldable", "FoulBallNotFieldable", "InPlay"), "Swing", "Take"),
Chase = ifelse(SwingTake == "Swing" & (PitchSide < -0.85 | PitchSide > 0.85 | PitchHeight < 1.5 | PitchHeight > 3.5), "Chase", "Non-Chase")
)
# Create the scatter plot with specified strike zone boxes
ggplot(pitch_location_data, aes(x = PitchSide, y = PitchHeight, color = SwingTake, shape = Chase)) +
geom_point(size = 3) +
geom_rect(aes(xmin = -0.5, xmax = 0.5, ymin = 1.75, ymax = 3.25), fill = NA, color = "red", linetype = "solid", size = 1) +
geom_rect(aes(xmin = -0.85, xmax = 0.85, ymin = 1.5, ymax = 3.5), fill = NA, color = "black", linetype = "solid", size = 1) +
geom_rect(aes(xmin = -1.25, xmax = 1.25, ymin = 1.25, ymax = 3.75), fill = NA, color = "gray", linetype = "solid", size = 1) +
scale_x_continuous(limits = c(-2, 2)) +
scale_y_continuous(limits = c(0, 5)) +
coord_fixed(ratio = 1) +
labs(title = "Pitch Locations for Reed Interdonato",
x = "Horizontal Location (feet)",
y = "Vertical Location (feet)",
color = "Swing/Take",
shape = "Chase") +
facet_wrap(~ AutoPitchType) +
theme_minimal() +
theme(
legend.position = "right",
panel.grid.major = element_line(color = "grey80"),
panel.grid.minor = element_line(color = "grey90"),
axis.text = element_text(color = "black"),
axis.title = element_text(color = "black"),
plot.title = element_text(color = "black"),
legend.background = element_rect(fill = "white", color = NA),
legend.key = element_rect(fill = "white", color = NA),
legend.text = element_text(color = "black"),
legend.title = element_text(color = "black")
)

# Create the scatter plot for horizontal and vertical breaks
ggplot(detailed_pitch_table, aes(x = HorizontalBreak, y = InducedVerticalBreak, color = AutoPitchType)) +
geom_point(size = 3) + # Increase point size
scale_x_continuous(limits = c(-25, 25)) + # Set horizontal limits to +/- 25 inches
scale_y_continuous(limits = c(-25, 25)) + # Set vertical limits to +/- 25 inches
labs(title = paste("Pitch Movement"),
x = "Horizontal Break (inches)",
y = "Induced Vertical Break (inches)",
color = "Pitch Type") +
theme_minimal() +
theme(
legend.position = "right",
panel.grid.major = element_line(color = "grey80"),
panel.grid.minor = element_line(color = "grey90"),
axis.text = element_text(color = "black"),
axis.title = element_text(color = "black"),
plot.title = element_text(color = "black"),
legend.background = element_rect(fill = "white", color = NA),
legend.key = element_rect(fill = "white", color = NA),
legend.text = element_text(color = "black"),
legend.title = element_text(color = "black")
)
