# 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 |
90.87 |
2369.20 |
241.00 |
19.55 |
11.96 |
BallCalled |
5.34 |
2.72 |
5.77 |
8.0 |
Sinker |
91.53 |
2525.95 |
241.36 |
20.03 |
12.06 |
StrikeSwinging |
5.24 |
2.76 |
5.52 |
8.0 |
Sinker |
91.66 |
2503.47 |
239.90 |
21.07 |
13.35 |
BallCalled |
5.35 |
2.75 |
5.68 |
8.0 |
Sinker |
91.93 |
2507.00 |
241.91 |
19.58 |
11.54 |
FoulBallNotFieldable |
5.32 |
2.54 |
5.68 |
8.1 |
Sinker |
92.63 |
2514.42 |
247.89 |
22.11 |
10.29 |
InPlay |
5.35 |
2.65 |
5.64 |
8.3 |
Sinker |
91.58 |
2446.98 |
243.21 |
20.97 |
11.92 |
BallCalled |
5.56 |
2.47 |
5.78 |
8.1 |
Sinker |
92.02 |
2510.01 |
232.78 |
17.77 |
14.80 |
FoulBallNotFieldable |
5.51 |
2.46 |
5.31 |
7.8 |
Slider |
84.05 |
2306.82 |
288.00 |
1.50 |
1.12 |
BallCalled |
5.22 |
2.84 |
4.85 |
9.6 |
Slider |
84.50 |
2291.72 |
335.76 |
1.45 |
-2.04 |
InPlay |
5.20 |
2.75 |
5.17 |
11.2 |
Changeup |
84.98 |
1768.73 |
255.47 |
15.91 |
5.33 |
FoulBallNotFieldable |
5.14 |
2.76 |
5.63 |
8.5 |
Sinker |
92.01 |
2508.89 |
242.83 |
20.61 |
11.81 |
BallCalled |
5.48 |
2.69 |
5.64 |
8.1 |
Changeup |
85.46 |
1605.99 |
266.34 |
14.03 |
2.17 |
StrikeCalled |
4.98 |
2.76 |
5.65 |
8.9 |
Slider |
84.66 |
2235.13 |
213.23 |
0.10 |
1.42 |
BallCalled |
5.22 |
2.76 |
5.18 |
7.1 |
Sinker |
93.21 |
2522.38 |
238.79 |
18.93 |
12.64 |
InPlay |
5.53 |
2.64 |
5.52 |
8.0 |
Sinker |
89.93 |
2424.22 |
235.86 |
19.92 |
14.71 |
BallCalled |
5.45 |
2.70 |
5.15 |
7.9 |
Sinker |
89.48 |
2435.54 |
235.37 |
19.47 |
14.68 |
StrikeCalled |
5.32 |
2.53 |
5.35 |
7.8 |
Sinker |
90.54 |
2548.92 |
246.12 |
22.71 |
11.27 |
BallCalled |
5.35 |
2.67 |
5.47 |
8.2 |
Sinker |
90.07 |
2469.31 |
250.22 |
24.34 |
10.00 |
BallCalled |
5.30 |
2.59 |
5.15 |
8.3 |
Sinker |
90.95 |
2477.01 |
244.69 |
20.21 |
10.73 |
StrikeSwinging |
5.34 |
2.46 |
5.56 |
8.2 |
Sinker |
90.84 |
2504.30 |
241.42 |
22.57 |
13.49 |
StrikeCalled |
5.37 |
2.42 |
5.10 |
8.0 |
Sinker |
91.03 |
2473.75 |
235.60 |
18.67 |
13.89 |
FoulBallNotFieldable |
5.40 |
2.57 |
5.63 |
7.9 |
Four-Seam |
92.80 |
2488.90 |
227.64 |
15.39 |
15.29 |
FoulBallNotFieldable |
5.34 |
2.46 |
5.51 |
7.6 |
Changeup |
84.11 |
1661.34 |
270.88 |
14.65 |
1.03 |
FoulBallNotFieldable |
4.99 |
2.75 |
5.75 |
9.0 |
Slider |
85.37 |
2290.40 |
24.93 |
-2.20 |
-3.30 |
StrikeSwinging |
5.25 |
2.67 |
5.00 |
0.8 |
Changeup |
83.55 |
1718.55 |
246.43 |
15.25 |
7.89 |
BallCalled |
5.01 |
2.77 |
5.79 |
8.2 |
Four-Seam |
91.56 |
2523.70 |
228.58 |
17.49 |
16.63 |
BallCalled |
5.32 |
2.60 |
5.72 |
7.6 |
Sinker |
91.80 |
2591.58 |
239.68 |
20.05 |
12.99 |
BallCalled |
5.36 |
2.52 |
5.32 |
8.0 |
Sinker |
90.06 |
2469.00 |
234.31 |
18.11 |
14.24 |
BallCalled |
5.41 |
2.49 |
5.33 |
7.8 |
Slider |
84.02 |
2367.66 |
259.83 |
2.28 |
1.65 |
FoulBallNotFieldable |
5.36 |
2.42 |
5.03 |
8.7 |
Slider |
86.05 |
2349.32 |
243.45 |
1.45 |
2.21 |
BallCalled |
5.30 |
2.40 |
4.93 |
8.1 |
Slider |
85.08 |
2300.93 |
316.25 |
0.41 |
0.81 |
FoulBallNotFieldable |
5.29 |
2.25 |
4.82 |
10.5 |
Four-Seam |
92.96 |
2515.31 |
230.86 |
17.26 |
15.23 |
BallCalled |
5.76 |
1.96 |
5.58 |
7.7 |
Sinker |
92.78 |
2499.57 |
233.13 |
17.73 |
14.47 |
StrikeCalled |
5.66 |
1.94 |
5.41 |
7.8 |
Sinker |
89.68 |
2235.22 |
239.10 |
20.55 |
13.54 |
BallCalled |
5.45 |
2.43 |
5.05 |
8.0 |
Sinker |
89.85 |
2445.75 |
236.44 |
21.79 |
15.72 |
BallCalled |
5.46 |
2.48 |
5.05 |
7.9 |
Sinker |
90.65 |
2518.03 |
239.84 |
19.18 |
12.47 |
BallCalled |
5.43 |
2.27 |
5.14 |
8.0 |
Sinker |
89.61 |
2357.13 |
243.42 |
20.83 |
11.71 |
BallCalled |
5.50 |
2.31 |
5.29 |
8.1 |
Sinker |
90.45 |
2389.21 |
235.82 |
20.40 |
15.15 |
StrikeCalled |
5.70 |
2.04 |
5.16 |
7.9 |
Sinker |
90.75 |
2517.17 |
233.86 |
19.84 |
15.76 |
StrikeSwinging |
5.57 |
2.13 |
5.22 |
7.8 |
Sinker |
91.10 |
2419.26 |
232.43 |
22.33 |
18.48 |
BallCalled |
5.79 |
1.89 |
5.17 |
7.7 |
Sinker |
92.07 |
2544.94 |
238.70 |
19.89 |
13.31 |
BallCalled |
5.76 |
1.86 |
5.60 |
8.0 |
Slider |
84.83 |
2305.56 |
220.96 |
3.37 |
5.20 |
StrikeCalled |
5.35 |
2.22 |
5.04 |
7.4 |
Changeup |
84.42 |
1796.62 |
275.17 |
14.87 |
-0.05 |
BallCalled |
5.15 |
2.47 |
5.63 |
9.2 |
Sinker |
90.94 |
2500.15 |
237.22 |
20.05 |
14.19 |
StrikeCalled |
5.50 |
2.29 |
5.18 |
7.9 |
Sinker |
91.31 |
2398.16 |
233.80 |
19.54 |
15.50 |
BallCalled |
5.67 |
2.36 |
5.80 |
7.8 |
Sinker |
90.52 |
2395.31 |
243.16 |
20.60 |
11.70 |
BallCalled |
5.49 |
2.24 |
5.16 |
8.1 |
Sinker |
91.53 |
2484.35 |
237.92 |
20.42 |
14.03 |
BallCalled |
5.52 |
2.46 |
5.54 |
7.9 |
Sinker |
90.46 |
2434.94 |
239.24 |
20.93 |
13.74 |
InPlay |
5.66 |
2.22 |
5.32 |
8.0 |
Sinker |
90.77 |
2438.91 |
235.51 |
19.61 |
14.78 |
BallCalled |
5.46 |
2.42 |
5.23 |
7.9 |
Sinker |
91.84 |
2423.94 |
243.29 |
20.61 |
11.58 |
InPlay |
5.41 |
2.47 |
5.27 |
8.1 |
Sinker |
91.51 |
2485.01 |
242.89 |
21.35 |
12.13 |
StrikeCalled |
5.56 |
2.42 |
5.52 |
8.1 |
Changeup |
86.36 |
1802.91 |
243.02 |
15.60 |
9.13 |
InPlay |
5.07 |
2.52 |
5.84 |
8.1 |
Sinker |
89.57 |
2271.74 |
236.39 |
17.32 |
12.76 |
BallCalled |
5.50 |
2.63 |
5.21 |
7.9 |
Sinker |
90.50 |
2436.93 |
225.51 |
14.78 |
15.78 |
FoulBallNotFieldable |
5.61 |
2.27 |
5.21 |
7.5 |
Changeup |
83.52 |
1573.50 |
278.76 |
11.85 |
-0.52 |
StrikeCalled |
5.14 |
2.54 |
5.81 |
9.3 |
Sinker |
93.14 |
2489.24 |
237.50 |
19.49 |
13.61 |
FoulBallNotFieldable |
5.66 |
2.24 |
5.28 |
7.9 |
Changeup |
84.02 |
1913.03 |
261.04 |
17.76 |
4.07 |
InPlay |
5.07 |
2.54 |
5.51 |
8.7 |
Sinker |
92.06 |
2428.19 |
233.08 |
19.15 |
15.58 |
BallCalled |
5.41 |
2.43 |
5.53 |
7.8 |
Sinker |
91.12 |
2430.38 |
237.91 |
21.37 |
14.57 |
StrikeCalled |
5.36 |
2.38 |
5.63 |
7.9 |
Slider |
84.84 |
2471.18 |
328.34 |
0.68 |
0.20 |
BallCalled |
5.18 |
2.55 |
4.96 |
10.9 |
Sinker |
90.55 |
2332.73 |
241.92 |
22.11 |
13.04 |
BallCalled |
5.42 |
2.40 |
5.01 |
8.1 |
Sinker |
91.89 |
2328.23 |
237.03 |
19.79 |
13.97 |
StrikeSwinging |
5.49 |
2.26 |
5.36 |
7.9 |
Sinker |
91.67 |
2478.86 |
230.33 |
18.57 |
16.59 |
StrikeSwinging |
5.56 |
2.23 |
5.59 |
7.7 |
Four-Seam |
93.71 |
2532.92 |
229.81 |
18.44 |
16.70 |
BallCalled |
5.63 |
2.08 |
5.43 |
7.7 |
Sinker |
91.49 |
2496.10 |
235.66 |
18.76 |
13.97 |
StrikeCalled |
5.47 |
2.29 |
5.56 |
7.9 |
Four-Seam |
93.86 |
2457.62 |
228.25 |
19.76 |
18.79 |
BallCalled |
5.83 |
2.10 |
5.55 |
7.6 |
Slider |
84.74 |
2324.38 |
235.80 |
1.68 |
2.57 |
FoulBallNotFieldable |
5.38 |
2.55 |
5.04 |
7.9 |
Sinker |
92.19 |
2510.29 |
232.45 |
18.42 |
15.37 |
BallCalled |
5.67 |
2.23 |
5.69 |
7.7 |
Sinker |
92.13 |
2309.77 |
238.75 |
20.55 |
13.65 |
BallCalled |
5.82 |
2.04 |
5.63 |
8.0 |
Sinker |
90.15 |
2281.74 |
241.39 |
20.59 |
12.48 |
FoulBallNotFieldable |
5.41 |
2.25 |
5.35 |
8.0 |
Changeup |
83.70 |
1571.49 |
266.35 |
15.28 |
2.19 |
BallCalled |
5.10 |
2.42 |
5.42 |
8.9 |
Sinker |
90.66 |
2383.13 |
238.87 |
19.49 |
12.88 |
FoulBallNotFieldable |
5.45 |
2.25 |
5.23 |
8.0 |
Slider |
84.61 |
2270.95 |
305.04 |
1.09 |
0.46 |
StrikeCalled |
5.28 |
2.27 |
4.66 |
10.2 |
Sinker |
88.02 |
2433.60 |
233.98 |
18.88 |
15.00 |
FoulBallNotFieldable |
5.68 |
2.24 |
5.52 |
7.8 |
Slider |
83.46 |
2258.66 |
213.18 |
2.52 |
5.10 |
BallCalled |
5.50 |
2.24 |
5.04 |
7.1 |
Sinker |
90.28 |
2488.04 |
229.19 |
17.10 |
16.05 |
BallCalled |
5.67 |
2.08 |
5.25 |
7.6 |
Sinker |
89.20 |
2244.14 |
228.60 |
17.83 |
17.00 |
FoulBallNotFieldable |
5.78 |
2.02 |
5.64 |
7.6 |
Slider |
84.79 |
2198.02 |
259.15 |
2.09 |
1.73 |
BallCalled |
5.35 |
2.49 |
5.18 |
8.6 |
Slider |
84.14 |
2193.53 |
323.00 |
0.28 |
0.69 |
FoulBallNotFieldable |
5.40 |
2.42 |
5.15 |
10.8 |
Sinker |
90.81 |
2282.40 |
237.10 |
19.72 |
13.91 |
BallCalled |
5.69 |
2.15 |
5.44 |
7.9 |
# 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 == "BallCalled"),
Strikes = sum(PitchCall != "BallCalled"), # 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: 80
# Display the summary table
knitr::kable(pitch_summary, caption = "Summary Pitch Table for Reed Interdonato")
Summary Pitch Table for Reed Interdonato
Changeup |
11.25% |
9 |
3 |
6 |
33.33% |
66.67% |
84.46 |
1712.46 |
3.47 |
15.02 |
262.61 |
8.8 |
5.07 |
2.61 |
5.67 |
Four-Seam |
6.25% |
5 |
4 |
1 |
80.00% |
20.00% |
92.98 |
2503.69 |
16.53 |
17.67 |
229.03 |
7.6 |
5.58 |
2.24 |
5.56 |
Sinker |
65.00% |
52 |
26 |
26 |
50.00% |
50.00% |
91.03 |
2440.66 |
13.67 |
19.93 |
237.97 |
7.9 |
5.50 |
2.37 |
5.40 |
Slider |
17.50% |
14 |
6 |
8 |
42.86% |
57.14% |
84.65 |
2297.45 |
1.27 |
1.19 |
254.78 |
8.5 |
5.31 |
2.49 |
5.00 |
# 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.86 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", "FoulBallNonSwinging", "FoulBallFieldable", "FoulBallNotFieldable", "InPlay"), "Swing", "Take"),
Chase = ifelse(SwingTake == "Swing" & (PitchSide < -0.75 | PitchSide > 0.75 | 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.75, xmax = 0.75, 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")
)
