# Filter the data for the pitcher Nick Falter
Nick_Falter_data <- data %>%
filter(Pitcher == "Falter, Nick")
# Create a detailed table for each pitch
detailed_pitch_table <- Nick_Falter_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 Nick Falter")
Detailed Pitch Table for Nick Falter
Four-Seam |
91.57 |
2347.55 |
224.00 |
14.16 |
15.87 |
StrikeCalled |
5.49 |
1.78 |
5.61 |
7.5 |
Slider |
85.93 |
2296.11 |
175.25 |
-0.72 |
9.91 |
BallCalled |
5.51 |
1.88 |
5.04 |
5.8 |
Four-Seam |
92.72 |
2448.48 |
223.03 |
12.40 |
14.35 |
StrikeSwinging |
5.43 |
1.87 |
5.58 |
7.4 |
Four-Seam |
92.71 |
2459.02 |
218.17 |
10.47 |
14.42 |
StrikeSwinging |
5.45 |
1.89 |
5.42 |
7.3 |
Sinker |
91.84 |
2270.35 |
233.41 |
16.69 |
13.58 |
BallCalled |
5.43 |
1.72 |
5.68 |
7.8 |
Slider |
86.89 |
2410.11 |
181.69 |
0.27 |
10.29 |
InPlay |
5.50 |
1.96 |
5.00 |
6.1 |
Slider |
83.53 |
2294.02 |
161.47 |
-3.28 |
11.02 |
BallCalled |
5.51 |
1.70 |
5.19 |
5.4 |
Sinker |
91.26 |
2515.25 |
234.32 |
17.38 |
13.64 |
FoulBallNotFieldable |
5.52 |
1.72 |
5.50 |
7.8 |
Sinker |
92.69 |
2492.58 |
231.75 |
17.22 |
14.72 |
BallCalled |
5.48 |
1.77 |
5.40 |
7.7 |
Sinker |
90.74 |
2344.60 |
241.71 |
16.87 |
10.32 |
InPlay |
5.55 |
1.87 |
5.23 |
8.1 |
Slider |
86.13 |
2440.90 |
182.88 |
0.40 |
9.02 |
BallCalled |
5.68 |
1.73 |
5.02 |
6.1 |
Four-Seam |
92.91 |
2556.83 |
229.79 |
15.32 |
14.05 |
BallCalled |
5.50 |
1.83 |
5.49 |
7.7 |
Four-Seam |
93.72 |
2506.09 |
231.65 |
14.72 |
12.73 |
StrikeCalled |
5.51 |
1.73 |
5.44 |
7.7 |
Four-Seam |
92.13 |
2443.54 |
206.74 |
8.17 |
17.30 |
StrikeSwinging |
5.49 |
1.63 |
5.26 |
6.9 |
Four-Seam |
93.84 |
2518.16 |
203.76 |
7.21 |
17.44 |
StrikeSwinging |
5.54 |
1.72 |
5.23 |
6.8 |
Slider |
85.26 |
2351.77 |
191.29 |
1.28 |
7.54 |
StrikeCalled |
5.59 |
1.78 |
5.11 |
6.4 |
Sinker |
90.86 |
2492.11 |
228.02 |
14.51 |
14.17 |
StrikeCalled |
5.46 |
1.90 |
5.55 |
7.6 |
Slider |
81.40 |
2457.89 |
100.71 |
-4.74 |
2.49 |
StrikeSwinging |
5.67 |
1.76 |
5.06 |
3.4 |
Four-Seam |
92.32 |
2493.95 |
226.72 |
15.53 |
15.72 |
BallCalled |
5.52 |
1.83 |
5.60 |
7.6 |
Four-Seam |
91.61 |
2470.48 |
226.74 |
13.28 |
13.60 |
InPlay |
5.53 |
1.82 |
5.45 |
7.6 |
Four-Seam |
91.70 |
2544.91 |
221.74 |
14.22 |
17.08 |
StrikeSwinging |
5.53 |
1.61 |
5.51 |
7.4 |
Four-Seam |
92.19 |
2534.41 |
227.61 |
15.63 |
15.39 |
StrikeCalled |
5.49 |
1.61 |
5.64 |
7.6 |
Four-Seam |
93.28 |
2567.72 |
231.38 |
17.01 |
14.71 |
BallCalled |
5.70 |
1.73 |
5.49 |
7.7 |
Slider |
81.50 |
2491.27 |
107.67 |
-4.96 |
2.84 |
BallCalled |
5.65 |
1.69 |
5.04 |
3.6 |
Slider |
85.80 |
2442.11 |
160.70 |
-2.05 |
6.99 |
InPlay |
5.61 |
1.60 |
5.19 |
5.4 |
Four-Seam |
91.10 |
2529.97 |
225.58 |
13.88 |
14.84 |
InPlay |
5.50 |
1.77 |
5.54 |
7.5 |
Slider |
84.87 |
2413.82 |
195.68 |
3.04 |
12.04 |
BallCalled |
5.64 |
1.63 |
5.40 |
6.5 |
Sinker |
91.10 |
2507.87 |
231.17 |
16.63 |
14.58 |
StrikeCalled |
5.54 |
1.76 |
5.52 |
7.7 |
Four-Seam |
89.71 |
2431.64 |
218.97 |
13.00 |
17.33 |
FoulBallNotFieldable |
5.50 |
1.88 |
5.51 |
7.3 |
Slider |
86.26 |
2453.37 |
187.09 |
0.96 |
8.99 |
FoulBallNotFieldable |
5.67 |
1.63 |
4.96 |
6.2 |
Four-Seam |
92.20 |
2512.28 |
227.85 |
13.51 |
13.42 |
FoulBallNotFieldable |
5.50 |
1.70 |
5.54 |
7.6 |
Slider |
81.99 |
2423.98 |
80.68 |
-4.97 |
0.45 |
StrikeCalled |
5.64 |
1.55 |
5.14 |
2.7 |
Slider |
86.46 |
2397.27 |
182.53 |
0.35 |
9.11 |
FoulBallNotFieldable |
5.51 |
1.74 |
5.20 |
6.1 |
Sinker |
89.79 |
2343.44 |
246.16 |
18.36 |
9.37 |
BallCalled |
5.48 |
1.88 |
5.01 |
8.2 |
Four-Seam |
90.96 |
2520.78 |
217.98 |
12.10 |
16.71 |
FoulBallNotFieldable |
5.51 |
1.77 |
5.44 |
7.3 |
Slider |
86.24 |
2400.55 |
163.25 |
-2.01 |
7.89 |
BallCalled |
5.51 |
1.75 |
5.06 |
5.4 |
Sinker |
91.98 |
2437.96 |
225.61 |
11.37 |
12.15 |
FoulBallNotFieldable |
5.49 |
1.72 |
5.62 |
7.5 |
Changeup |
86.42 |
1720.56 |
261.82 |
19.72 |
4.07 |
InPlay |
5.54 |
1.74 |
5.34 |
8.7 |
Four-Seam |
92.87 |
2566.44 |
215.76 |
12.68 |
18.85 |
StrikeSwinging |
5.56 |
1.77 |
5.44 |
7.2 |
Cutter |
86.13 |
2464.80 |
173.27 |
-1.36 |
12.83 |
BallCalled |
5.54 |
1.78 |
5.11 |
5.8 |
Slider |
87.11 |
2486.05 |
190.03 |
2.02 |
12.67 |
StrikeCalled |
5.59 |
1.96 |
5.13 |
6.3 |
Four-Seam |
92.42 |
2583.59 |
223.91 |
13.25 |
15.00 |
BallCalled |
5.58 |
1.84 |
5.37 |
7.5 |
Slider |
83.83 |
2369.28 |
154.11 |
-1.62 |
4.71 |
StrikeSwinging |
5.55 |
1.49 |
5.05 |
5.1 |
Slider |
86.56 |
2493.34 |
198.39 |
3.34 |
11.24 |
BallCalled |
5.50 |
1.67 |
5.09 |
6.6 |
Four-Seam |
91.62 |
2540.62 |
223.71 |
15.04 |
16.92 |
StrikeCalled |
5.45 |
1.75 |
5.92 |
7.5 |
Four-Seam |
92.56 |
2571.84 |
230.59 |
17.25 |
15.42 |
FoulBallNotFieldable |
5.52 |
1.65 |
5.58 |
7.7 |
Four-Seam |
93.38 |
2561.37 |
233.62 |
17.50 |
14.01 |
FoulBallNotFieldable |
5.57 |
1.64 |
5.64 |
7.8 |
Slider |
82.84 |
2341.90 |
131.97 |
-3.02 |
4.10 |
StrikeSwinging |
5.58 |
1.55 |
5.08 |
4.4 |
Four-Seam |
92.11 |
2523.19 |
214.85 |
10.08 |
15.62 |
StrikeSwinging |
5.47 |
1.67 |
5.37 |
7.2 |
Four-Seam |
93.43 |
2550.37 |
217.33 |
12.56 |
17.62 |
BallCalled |
5.51 |
1.82 |
5.69 |
7.2 |
Sinker |
92.13 |
2507.33 |
232.50 |
15.83 |
13.28 |
BallCalled |
5.39 |
1.67 |
5.68 |
7.8 |
Four-Seam |
91.99 |
2531.43 |
217.82 |
12.31 |
17.00 |
BallCalled |
5.50 |
1.81 |
5.49 |
7.3 |
Slider |
87.25 |
2467.05 |
202.15 |
2.35 |
6.99 |
StrikeSwinging |
5.44 |
1.65 |
5.21 |
6.7 |
Cutter |
87.38 |
2380.11 |
192.54 |
2.22 |
11.08 |
InPlay |
5.45 |
1.67 |
5.35 |
6.4 |
Four-Seam |
91.48 |
2509.76 |
219.86 |
14.54 |
18.67 |
BallCalled |
5.54 |
1.67 |
5.63 |
7.3 |
Four-Seam |
90.91 |
2544.74 |
218.62 |
12.98 |
17.44 |
StrikeSwinging |
5.54 |
1.89 |
5.43 |
7.3 |
Four-Seam |
92.48 |
2528.26 |
226.60 |
15.71 |
15.96 |
FoulBallNotFieldable |
5.59 |
1.70 |
5.63 |
7.6 |
Four-Seam |
92.77 |
2508.38 |
227.59 |
15.00 |
14.82 |
StrikeSwinging |
5.65 |
1.74 |
5.46 |
7.6 |
Sinker |
91.39 |
2468.71 |
239.29 |
19.80 |
12.90 |
BallCalled |
5.45 |
1.69 |
5.62 |
8.0 |
Slider |
84.60 |
2455.27 |
187.95 |
0.71 |
6.21 |
StrikeCalled |
5.54 |
1.76 |
5.20 |
6.3 |
Sinker |
91.32 |
2566.78 |
235.34 |
17.77 |
13.38 |
BallCalled |
5.55 |
1.82 |
5.51 |
7.8 |
Sinker |
91.05 |
2558.12 |
234.30 |
17.11 |
13.39 |
BallCalled |
5.56 |
1.61 |
5.64 |
7.8 |
Sinker |
91.18 |
2441.12 |
234.26 |
18.65 |
14.60 |
HitByPitch |
5.62 |
1.65 |
5.56 |
7.8 |
Sinker |
90.17 |
2377.54 |
222.08 |
13.42 |
16.07 |
StrikeCalled |
5.58 |
1.89 |
5.17 |
7.4 |
Four-Seam |
90.41 |
2389.64 |
217.20 |
11.83 |
16.75 |
StrikeSwinging |
5.59 |
1.72 |
5.20 |
7.2 |
Sinker |
91.16 |
2311.08 |
227.73 |
15.92 |
15.65 |
StrikeSwinging |
5.62 |
1.71 |
5.56 |
7.6 |
Sinker |
89.98 |
2408.13 |
225.30 |
15.87 |
16.93 |
StrikeCalled |
5.61 |
1.75 |
5.33 |
7.5 |
Four-Seam |
92.48 |
2475.17 |
223.01 |
14.08 |
16.26 |
BallCalled |
5.59 |
1.71 |
5.53 |
7.4 |
Slider |
85.05 |
2347.52 |
181.65 |
0.20 |
8.30 |
InPlay |
5.65 |
1.69 |
5.25 |
6.1 |
Four-Seam |
92.45 |
2572.15 |
235.09 |
18.35 |
13.96 |
FoulBallNotFieldable |
5.57 |
1.70 |
5.45 |
7.8 |
Sinker |
92.23 |
2369.03 |
245.48 |
19.63 |
10.20 |
FoulBallNotFieldable |
5.59 |
1.65 |
5.71 |
8.2 |
Four-Seam |
92.61 |
2486.22 |
226.74 |
13.43 |
13.62 |
FoulBallNotFieldable |
5.60 |
1.72 |
5.66 |
7.6 |
Sinker |
92.73 |
2320.83 |
236.43 |
18.10 |
13.20 |
FoulBallNotFieldable |
5.60 |
1.64 |
5.79 |
7.9 |
Four-Seam |
88.06 |
2397.05 |
188.18 |
1.82 |
13.92 |
InPlay |
5.64 |
1.60 |
5.52 |
6.3 |
# 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: 74
# Display the summary table
knitr::kable(pitch_summary, caption = "Summary Pitch Table for Nick Falter")
Summary Pitch Table for Nick Falter
Changeup |
1.35% |
1 |
0 |
1 |
0.00% |
100.00% |
86.42 |
1720.56 |
4.07 |
19.72 |
261.82 |
8.7 |
5.54 |
1.74 |
5.34 |
Cutter |
2.70% |
2 |
1 |
1 |
50.00% |
50.00% |
86.75 |
2422.46 |
11.96 |
0.43 |
182.90 |
6.1 |
5.50 |
1.73 |
5.23 |
Four-Seam |
44.59% |
33 |
8 |
25 |
24.24% |
75.76% |
92.08 |
2506.85 |
15.66 |
13.30 |
221.88 |
7.4 |
5.54 |
1.74 |
5.51 |
Sinker |
24.32% |
18 |
7 |
11 |
38.89% |
61.11% |
91.31 |
2429.60 |
13.45 |
16.73 |
233.60 |
7.8 |
5.53 |
1.75 |
5.50 |
Slider |
27.03% |
20 |
7 |
13 |
35.00% |
65.00% |
84.97 |
2411.68 |
7.64 |
-0.62 |
165.86 |
5.5 |
5.58 |
1.71 |
5.12 |
# 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("Nick Falter maximum FB velocity: ", max_fb_velocity, "mph\n")
## Nick Falter maximum FB velocity: 93.84 mph
# Prepare data for plotting pitch locations
pitch_location_data <- Nick_Falter_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 Nick Falter",
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
labs(title = "Pitch Movement for Nick Falter",
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")
)
