Skip to contents

Retrieve Homerun Derby data

Usage

mlb_homerun_derby(game_pk)

Arguments

game_pk

The game_pk for which you want to return data

Value

Returns a tibble with the following columns

col_nametypesdescription
game_pkintegerMLB game primary key for the Home Run Derby event.
event_namecharacterEvent name (e.g. 'All-Star Workout Day: Home Run Derby').
event_datecharacterEvent date-time in ISO 8601 (e.g. '2017-07-11T00:00:00Z').
event_type_codecharacterSingle-letter event type code (e.g. 'O').
event_type_namecharacterEvent type name (e.g. 'Other').
venue_idintegerMLB venue id hosting the event.
venue_namecharacterVenue name (e.g. 'Marlins Park').
roundintegerDerby round number for the matchup.
battercharacterFull name of the batter for this swing record.
batter_idintegerMLB player id of the batter.
batter_linkcharacterAPI relative link to the batter.
top_seed_completelogicalWhether the top seed's turn in the matchup is complete.
top_seed_startedlogicalWhether the top seed's turn in the matchup has started.
top_seed_winnerlogicalWhether the top seed won the matchup.
bonus_timelogicalWhether the swing occurred during bonus time.
home_runlogicalWhether the swing was scored a home run.
tie_breakerlogicalWhether the swing occurred during a tie-breaker.
is_home_runlogicalWhether the recorded hit is a home run.
time_remainingcharacterTime remaining on the clock when the swing occurred.
is_bonus_timelogicalWhether the swing counted toward bonus time.
is_tie_breakerlogicalWhether the swing counted toward a tie-breaker.
hit_data_launch_speedintegerExit velocity of the home run swing (mph).
hit_data_launch_angleintegerLaunch angle of the batted ball (degrees).
hit_data_total_distanceintegerProjected total distance of the batted ball (feet).
hit_data_coordinates_coord_xnumericHit location x-coordinate on the field overlay.
hit_data_coordinates_coord_ynumericHit location y-coordinate on the field overlay.
hit_data_coordinates_landing_pos_xnumericLanding position x-coordinate of the batted ball.
hit_data_coordinates_landing_pos_ynumericLanding position y-coordinate of the batted ball.
hit_data_trajectory_data_trajectory_polynomial_xlistPolynomial coefficients of the x trajectory.
hit_data_trajectory_data_trajectory_polynomial_ylistPolynomial coefficients of the y trajectory.
hit_data_trajectory_data_trajectory_polynomial_zlistPolynomial coefficients of the z trajectory.
hit_data_trajectory_data_valid_time_intervallistValid time interval for the trajectory fit (seconds).
top_seed_seedintegerBracket seed number of the top seed.
top_seed_is_winnerlogicalWhether the top seed is the matchup winner.
top_seed_is_completelogicalWhether the top seed's turn is complete.
top_seed_is_startedlogicalWhether the top seed's turn has started.
top_seed_num_home_runsintegerNumber of home runs hit by the top seed.
top_seed_player_idintegerMLB player id of the top seed.
top_seed_player_full_namecharacterFull name of the top seed.
top_seed_player_linkcharacterAPI relative link to the top seed player.
top_seed_top_derby_hit_data_launch_speedintegerTop seed's hardest-hit exit velocity in the round (mph).
top_seed_top_derby_hit_data_total_distanceintegerTop seed's longest projected distance in the round (feet).
bottom_seed_completelogicalWhether the bottom seed's turn in the matchup is complete.
bottom_seed_startedlogicalWhether the bottom seed's turn in the matchup has started.
bottom_seed_winnerlogicalWhether the bottom seed won the matchup.
bottom_seed_seedintegerBracket seed number of the bottom seed.
bottom_seed_is_winnerlogicalWhether the bottom seed is the matchup winner.
bottom_seed_is_completelogicalWhether the bottom seed's turn is complete.
bottom_seed_is_startedlogicalWhether the bottom seed's turn has started.
bottom_seed_num_home_runsintegerNumber of home runs hit by the bottom seed.
bottom_seed_player_idintegerMLB player id of the bottom seed.
bottom_seed_player_full_namecharacterFull name of the bottom seed.
bottom_seed_player_linkcharacterAPI relative link to the bottom seed player.
bottom_seed_top_derby_hit_data_launch_speedintegerBottom seed's hardest-hit exit velocity in the round (mph).
bottom_seed_top_derby_hit_data_total_distanceintegerBottom seed's longest projected distance in the round (feet).
venue_linkcharacterAPI relative link to the event venue.
is_multi_daylogicalWhether the event spans multiple days.
is_primary_calendarlogicalWhether the event is on the primary calendar.
file_codecharacterInternal file code for the event.
event_numberintegerEvent number identifier.
public_facinglogicalWhether the event is public facing.

Examples

# \donttest{
  try(mlb_homerun_derby(game_pk = 511101))
#> ── MLB Homerun Derby data from MLB.com ────────────── baseballr 2.0.0 ──
#>  Data updated: 2026-06-12 14:09:36 UTC
#> # A tibble: 396 × 61
#>    game_pk event_name         event_date event_type_code event_type_name
#>      <int> <chr>              <chr>      <chr>           <chr>          
#>  1  511101 All-Star Workout … 2017-07-1… O               Other          
#>  2  511101 All-Star Workout … 2017-07-1… O               Other          
#>  3  511101 All-Star Workout … 2017-07-1… O               Other          
#>  4  511101 All-Star Workout … 2017-07-1… O               Other          
#>  5  511101 All-Star Workout … 2017-07-1… O               Other          
#>  6  511101 All-Star Workout … 2017-07-1… O               Other          
#>  7  511101 All-Star Workout … 2017-07-1… O               Other          
#>  8  511101 All-Star Workout … 2017-07-1… O               Other          
#>  9  511101 All-Star Workout … 2017-07-1… O               Other          
#> 10  511101 All-Star Workout … 2017-07-1… O               Other          
#> # ℹ 386 more rows
#> # ℹ 56 more variables: venue_id <int>, venue_name <chr>, round <int>,
#> #   batter <chr>, batter_id <int>, batter_link <chr>,
#> #   top_seed_complete <lgl>, top_seed_started <lgl>,
#> #   top_seed_winner <lgl>, bonus_time <lgl>, home_run <lgl>,
#> #   tie_breaker <lgl>, is_home_run <lgl>, time_remaining <chr>,
#> #   is_bonus_time <lgl>, is_tie_breaker <lgl>, …
# }