# 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 |
87.69 |
2396.19 |
231.29 |
18.70 |
16.45 |
InPlay |
5.67 |
2.43 |
5.40 |
7.7 |
Sinker |
91.20 |
2519.83 |
234.73 |
19.28 |
15.02 |
BallCalled |
5.57 |
2.77 |
5.36 |
7.8 |
Sinker |
90.36 |
2470.84 |
232.30 |
18.51 |
15.72 |
StrikeCalled |
5.45 |
2.68 |
5.25 |
7.7 |
Changeup |
83.05 |
1825.52 |
268.19 |
15.94 |
1.91 |
BallCalled |
5.07 |
2.79 |
5.85 |
8.9 |
Sinker |
89.97 |
2452.04 |
238.12 |
21.11 |
14.48 |
StrikeSwinging |
5.37 |
2.48 |
5.32 |
7.9 |
Sinker |
91.24 |
2407.90 |
244.40 |
21.00 |
11.35 |
BallCalled |
5.47 |
2.58 |
5.55 |
8.1 |
Sinker |
90.24 |
2432.74 |
236.61 |
19.16 |
13.99 |
InPlay |
5.38 |
2.41 |
5.52 |
7.9 |
Sinker |
90.09 |
2377.39 |
248.81 |
23.42 |
10.39 |
BallCalled |
5.49 |
2.57 |
5.59 |
8.3 |
Sinker |
89.76 |
2426.49 |
234.82 |
18.16 |
14.13 |
FoulBallNotFieldable |
5.39 |
2.62 |
5.46 |
7.8 |
Sinker |
90.59 |
2457.60 |
247.66 |
22.25 |
10.47 |
StrikeSwinging |
5.45 |
2.66 |
5.28 |
8.3 |
Changeup |
84.36 |
1861.47 |
259.56 |
17.49 |
4.52 |
InPlay |
5.11 |
2.59 |
5.41 |
8.7 |
Sinker |
88.17 |
2289.96 |
227.90 |
12.60 |
12.68 |
StrikeCalled |
5.70 |
2.27 |
5.57 |
7.6 |
Slider |
82.77 |
2313.62 |
240.72 |
1.27 |
1.96 |
StrikeCalled |
5.44 |
2.49 |
4.99 |
8.0 |
Sinker |
90.69 |
2362.41 |
227.65 |
15.45 |
15.35 |
FoulBallNotFieldable |
5.85 |
2.18 |
5.26 |
7.6 |
Sinker |
89.86 |
2314.58 |
223.18 |
15.19 |
17.53 |
BallCalled |
5.85 |
2.03 |
5.43 |
7.4 |
Slider |
81.77 |
2404.45 |
48.17 |
-1.57 |
-0.12 |
BallCalled |
5.39 |
2.40 |
5.01 |
1.6 |
Four-Seam |
90.88 |
2370.17 |
224.08 |
16.36 |
18.17 |
StrikeSwinging |
5.68 |
2.19 |
5.56 |
7.5 |
Sinker |
89.84 |
2454.26 |
239.85 |
19.86 |
12.87 |
InPlay |
5.48 |
2.72 |
5.54 |
8.0 |
Sinker |
88.94 |
2383.27 |
225.16 |
17.26 |
18.50 |
BallCalled |
5.73 |
2.10 |
5.69 |
7.5 |
Sinker |
89.99 |
2474.40 |
223.67 |
16.49 |
18.64 |
StrikeCalled |
5.73 |
2.10 |
5.41 |
7.5 |
Slider |
83.90 |
2227.11 |
260.62 |
0.77 |
1.59 |
BallCalled |
5.25 |
2.42 |
5.32 |
8.7 |
Sinker |
90.11 |
2366.50 |
223.82 |
16.22 |
18.23 |
FoulBallNotFieldable |
5.62 |
2.27 |
5.57 |
7.5 |
Slider |
84.46 |
2287.94 |
262.63 |
2.61 |
1.41 |
InPlay |
5.48 |
2.56 |
5.18 |
8.8 |
Sinker |
90.69 |
2471.50 |
240.56 |
22.50 |
13.95 |
FoulBallNotFieldable |
5.52 |
2.36 |
5.23 |
8.0 |
Changeup |
83.62 |
1896.50 |
249.11 |
15.22 |
7.11 |
InPlay |
5.24 |
2.45 |
5.63 |
8.3 |
Sinker |
90.65 |
2345.59 |
228.06 |
18.48 |
17.85 |
BallCalled |
5.71 |
2.21 |
5.07 |
7.6 |
Sinker |
89.50 |
2341.43 |
227.89 |
17.75 |
17.29 |
BallCalled |
5.76 |
2.13 |
5.50 |
7.6 |
Sinker |
89.77 |
2472.28 |
236.20 |
20.69 |
15.06 |
BallCalled |
5.68 |
2.33 |
5.45 |
7.9 |
Sinker |
89.83 |
2253.96 |
231.66 |
18.23 |
15.61 |
BallCalled |
5.76 |
2.08 |
5.49 |
7.7 |
Sinker |
89.67 |
2486.97 |
243.26 |
22.34 |
12.48 |
StrikeCalled |
5.51 |
2.51 |
5.64 |
8.1 |
Sinker |
90.42 |
2402.81 |
239.76 |
20.61 |
13.21 |
BallCalled |
5.56 |
2.46 |
5.11 |
8.0 |
Sinker |
90.42 |
2401.66 |
237.59 |
20.83 |
14.41 |
StrikeSwinging |
5.50 |
2.54 |
5.39 |
7.9 |
Sinker |
92.35 |
2456.05 |
236.30 |
19.60 |
14.22 |
FoulBallNotFieldable |
5.70 |
2.31 |
5.55 |
7.9 |
Changeup |
83.56 |
1631.07 |
245.91 |
16.56 |
8.69 |
StrikeCalled |
5.28 |
2.78 |
5.56 |
8.2 |
Slider |
82.01 |
2230.41 |
198.96 |
0.57 |
3.00 |
StrikeSwinging |
5.48 |
2.53 |
4.98 |
6.6 |
Sinker |
90.37 |
2366.38 |
229.99 |
19.15 |
17.30 |
FoulBallNotFieldable |
5.81 |
2.11 |
5.39 |
7.7 |
Sinker |
90.44 |
2419.28 |
230.37 |
19.02 |
17.02 |
BallCalled |
5.88 |
1.99 |
5.40 |
7.7 |
Slider |
84.77 |
2361.09 |
247.47 |
3.75 |
2.74 |
InPlay |
5.50 |
2.30 |
5.04 |
8.2 |
Sinker |
90.11 |
2435.65 |
239.81 |
21.51 |
13.75 |
StrikeCalled |
5.57 |
2.52 |
5.39 |
8.0 |
Slider |
84.19 |
2311.86 |
263.37 |
3.06 |
1.76 |
BallCalled |
5.31 |
2.60 |
5.45 |
8.8 |
Sinker |
90.82 |
2423.03 |
236.95 |
21.85 |
15.42 |
FoulBallNotFieldable |
5.49 |
2.23 |
5.46 |
7.9 |
Changeup |
83.28 |
1809.55 |
247.35 |
14.84 |
7.58 |
BallCalled |
5.26 |
2.67 |
5.50 |
8.2 |
Changeup |
83.95 |
1794.81 |
255.38 |
16.04 |
5.58 |
BallCalled |
5.15 |
2.52 |
5.66 |
8.5 |
Sinker |
90.97 |
2406.30 |
243.81 |
20.53 |
11.41 |
BallCalled |
5.53 |
2.18 |
5.77 |
8.1 |
Sinker |
90.40 |
2214.15 |
227.94 |
15.82 |
15.58 |
FoulBallNotFieldable |
5.46 |
2.40 |
5.25 |
7.6 |
Sinker |
90.86 |
2272.89 |
232.10 |
19.40 |
16.40 |
StrikeSwinging |
5.57 |
2.28 |
5.31 |
7.7 |
Sinker |
91.22 |
2365.42 |
236.16 |
20.72 |
15.16 |
BallCalled |
5.70 |
2.30 |
5.51 |
7.9 |
Changeup |
83.41 |
1838.15 |
252.62 |
17.21 |
6.76 |
BallCalled |
5.26 |
2.39 |
5.61 |
8.4 |
Sinker |
90.78 |
2368.34 |
234.01 |
21.38 |
16.78 |
FoulBallNotFieldable |
5.56 |
2.22 |
5.48 |
7.8 |
Slider |
83.77 |
2319.76 |
178.83 |
-0.04 |
3.27 |
StrikeSwinging |
5.37 |
2.50 |
5.04 |
6.0 |
Slider |
82.17 |
2199.34 |
170.58 |
-0.54 |
4.66 |
StrikeCalled |
5.54 |
2.36 |
5.06 |
5.7 |
Sinker |
90.78 |
2413.31 |
238.39 |
20.21 |
13.69 |
InPlay |
5.74 |
1.96 |
5.35 |
7.9 |
Changeup |
84.51 |
2062.24 |
233.93 |
14.41 |
11.86 |
BallCalled |
5.23 |
2.41 |
5.30 |
7.8 |
Sinker |
89.02 |
2439.25 |
230.63 |
18.45 |
16.43 |
BallCalled |
5.60 |
2.30 |
5.41 |
7.7 |
Sinker |
88.12 |
2379.58 |
234.25 |
18.50 |
14.64 |
BallCalled |
5.46 |
2.28 |
5.52 |
7.8 |
Sinker |
88.97 |
2441.39 |
241.13 |
20.86 |
12.78 |
StrikeCalled |
5.54 |
2.23 |
5.81 |
8.0 |
Sinker |
90.22 |
2423.43 |
231.01 |
19.05 |
16.68 |
FoulBallNotFieldable |
5.56 |
2.38 |
5.31 |
7.7 |
Sinker |
90.12 |
2420.64 |
238.28 |
21.37 |
14.49 |
InPlay |
5.55 |
2.23 |
5.30 |
7.9 |
Slider |
82.97 |
2104.18 |
296.09 |
1.91 |
0.62 |
StrikeSwinging |
5.40 |
2.34 |
5.15 |
9.9 |
Slider |
84.27 |
2280.59 |
224.31 |
3.58 |
5.08 |
InPlay |
5.40 |
2.41 |
5.67 |
7.5 |
Sinker |
90.39 |
2321.03 |
236.47 |
20.08 |
14.49 |
StrikeSwinging |
5.61 |
2.50 |
5.64 |
7.9 |
Sinker |
91.43 |
2429.73 |
232.39 |
19.76 |
16.40 |
BallCalled |
5.66 |
2.54 |
5.60 |
7.7 |
Sinker |
89.92 |
2311.85 |
234.98 |
19.66 |
14.98 |
BallCalled |
5.61 |
2.35 |
5.84 |
7.8 |
Sinker |
91.38 |
2359.67 |
235.84 |
21.30 |
15.61 |
FoulBallNotFieldable |
5.60 |
2.41 |
5.89 |
7.9 |
Slider |
84.77 |
2356.25 |
180.44 |
0.02 |
3.62 |
BallCalled |
5.45 |
2.45 |
4.94 |
6.0 |
Sinker |
91.47 |
2528.27 |
231.48 |
17.50 |
15.11 |
StrikeCalled |
5.59 |
2.31 |
5.66 |
7.7 |
Slider |
85.43 |
2219.59 |
224.57 |
2.94 |
4.14 |
BallCalled |
5.52 |
2.30 |
5.33 |
7.5 |
Four-Seam |
92.98 |
2582.56 |
233.05 |
19.36 |
15.70 |
StrikeCalled |
5.67 |
2.21 |
5.76 |
7.8 |
Slider |
82.74 |
2175.06 |
196.90 |
0.37 |
2.75 |
BallCalled |
5.48 |
2.49 |
5.08 |
6.6 |
Sinker |
92.21 |
2479.19 |
231.12 |
18.45 |
16.03 |
BallCalled |
5.68 |
1.97 |
5.86 |
7.7 |
Sinker |
91.46 |
2445.86 |
225.29 |
16.68 |
17.66 |
BallCalled |
5.70 |
2.22 |
5.94 |
7.5 |
Sinker |
91.07 |
2424.41 |
235.93 |
21.06 |
15.45 |
BallCalled |
5.58 |
2.31 |
5.60 |
7.9 |
Four-Seam |
91.93 |
2549.92 |
227.49 |
18.05 |
17.74 |
BallCalled |
5.50 |
2.46 |
5.73 |
7.6 |
Sinker |
91.77 |
2472.88 |
227.34 |
18.48 |
18.18 |
StrikeCalled |
5.58 |
2.42 |
6.05 |
7.6 |
Sinker |
91.74 |
2502.78 |
238.42 |
22.35 |
14.90 |
BallCalled |
5.64 |
2.37 |
5.82 |
7.9 |
Sinker |
91.84 |
2465.22 |
229.32 |
18.50 |
17.06 |
FoulBallNotFieldable |
5.53 |
2.28 |
5.65 |
7.6 |
Sinker |
93.52 |
2384.05 |
240.06 |
20.10 |
12.70 |
StrikeCalled |
5.60 |
2.17 |
5.59 |
8.0 |
# 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: 77
# Display the summary table
knitr::kable(pitch_summary, caption = "Summary Pitch Table for Reed Interdonato")
Summary Pitch Table for Reed Interdonato
Changeup |
10.39% |
8 |
5 |
3 |
62.50% |
37.50% |
83.72 |
1839.91 |
6.75 |
15.96 |
251.51 |
8.4 |
5.20 |
2.58 |
5.56 |
Four-Seam |
3.90% |
3 |
1 |
2 |
33.33% |
66.67% |
91.93 |
2500.88 |
17.20 |
17.92 |
228.21 |
7.6 |
5.62 |
2.29 |
5.68 |
Sinker |
67.53% |
52 |
21 |
31 |
40.38% |
59.62% |
90.45 |
2406.40 |
15.12 |
19.37 |
234.32 |
7.8 |
5.60 |
2.33 |
5.51 |
Slider |
18.18% |
14 |
6 |
8 |
42.86% |
57.14% |
83.57 |
2270.80 |
2.61 |
1.34 |
213.83 |
7.1 |
5.43 |
2.44 |
5.16 |
# Calculate maximum fastball velocity
max_fb_velocity <- detailed_pitch_table %>%
filter(AutoPitchType %in% c("Four-Seam", "Two-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.52 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")
)
