Relatively inexperienced R user here. I'm trying to analyze baseball games from the top five exit velocities of each one using the code below (with 1 being the highest downward).
SavantEV2 = SavantEV %>%
group_by(game_date, home_team, away_team) %>%
summarise(
EV1 = nth(launch_speed, 1, descending = T),
EV2 = nth(launch_speed, 2, descending = T),
EV3 = nth(launch_speed, 3, descending = T),
EV4 = nth(launch_speed, 4, descending = T),
EV5 = nth(launch_speed, 5, descending = T)
)
Everything's been going swimmingly thus far, but I want to find a way to associate each exit velocity with the team/player that hit it. I have another data frame below that I figure I could use to accomplish this.
Data frame with every exit velocity from last season
If anyone knows any functions I could use to add this data that would be amazing. Thank you for going through my little spiel here too. Cheers!