Skip to contents

MLB Sport Players

Usage

mlb_sports_players(sport_id = 1, season = 2021)

Arguments

sport_id

The sport_id to return information for.

season

The season to return information for.

Value

Returns a tibble with the following columns:

col_nametypesdescription
player_idintegerMLBAM player ID.
full_namecharacterPlayer full name.
linkcharacterAPI link to the player resource.
first_namecharacterPlayer first name.
last_namecharacterPlayer last name.
primary_numbercharacterPrimary uniform number.
birth_datecharacterDate of birth (YYYY-MM-DD).
current_ageintegerCurrent age in years.
birth_citycharacterCity of birth.
birth_countrycharacterCountry of birth.
heightcharacterListed height (feet and inches).
weightintegerListed weight in pounds.
activelogicalWhether the player is currently active.
use_namecharacterPreferred first name for display.
use_last_namecharacterPreferred last name for display.
middle_namecharacterPlayer middle name.
boxscore_namecharacterName as shown in box scores.
nick_namecharacterPlayer nickname.
gendercharacterPlayer gender code.
is_playerlogicalWhether the person is a player.
is_verifiedlogicalWhether the profile is verified.
pronunciationcharacterPhonetic pronunciation of the name.
mlb_debut_datecharacterMLB debut date (YYYY-MM-DD).
name_first_lastcharacterName in first-last order.
name_slugcharacterURL slug for the player.
first_last_namecharacterFirst and last name display.
last_first_namecharacterLast, first name display.
last_init_namecharacterLast name with first initial.
init_last_namecharacterFirst initial with last name.
full_fml_namecharacterFull first-middle-last name.
full_lfm_namecharacterFull last-first-middle name.
strike_zone_topnumericTop of the player's strike zone (feet).
strike_zone_bottomnumericBottom of the player's strike zone (feet).
birth_state_provincecharacterState or province of birth.
draft_yearintegerYear the player was drafted.
name_matrilinealcharacterMatrilineal (maternal) surname.
last_played_datecharacterDate of last MLB appearance.
name_titlecharacterName title prefix.
name_suffixcharacterName suffix (e.g., Jr., III).
death_datecharacterDate of death (YYYY-MM-DD).
death_citycharacterCity of death.
death_countrycharacterCountry of death.
current_team_idintegerCurrent team MLBAM ID.
current_team_namecharacterCurrent team name.
current_team_linkcharacterAPI link to the current team.
primary_position_codecharacterPrimary position code.
primary_position_namecharacterPrimary position name.
primary_position_typecharacterPrimary position type.
primary_position_abbreviationcharacterPrimary position abbreviation.
bat_side_codecharacterBatting side code (L/R/S).
bat_side_descriptioncharacterBatting side description.
pitch_hand_codecharacterThrowing hand code (L/R).
pitch_hand_descriptioncharacterThrowing hand description.

Examples

# \donttest{
  try(mlb_sports_players(sport_id = 1, season = 2021))
#> ── MLB Sports - Players data from MLB.com ─────────── baseballr 2.0.0 ──
#>  Data updated: 2026-06-12 14:09:53 UTC
#> # A tibble: 1,508 × 53
#>    player_id full_name        link   first_name last_name primary_number
#>        <int> <chr>            <chr>  <chr>      <chr>     <chr>         
#>  1    472551 Fernando Abad    /api/… Fernando   Abad      58            
#>  2    676265 Cory Abbott      /api/… Cory       Abbott    15            
#>  3    656061 Albert Abreu     /api/… Albert     Abreu     84            
#>  4    650556 Bryan Abreu      /api/… Bryan      Abreu     66            
#>  5    547989 José Abreu       /api/… José       Abreu     79            
#>  6    642758 Domingo Acevedo  /api/… Domingo    Acevedo   68            
#>  7    660670 Ronald Acuña Jr. /api/… Ronald     Acuña     13            
#>  8    592094 Jason Adam       /api/… Jason      Adam      60            
#>  9    642715 Willy Adames     /api/… Willy      Adames    27            
#> 10    613534 Austin Adams     /api/… Austin     Adams     54            
#> # ℹ 1,498 more rows
#> # ℹ 47 more variables: birth_date <chr>, current_age <int>,
#> #   birth_city <chr>, birth_country <chr>, height <chr>, weight <int>,
#> #   active <lgl>, use_name <chr>, use_last_name <chr>,
#> #   middle_name <chr>, boxscore_name <chr>, nick_name <chr>,
#> #   gender <chr>, is_player <lgl>, is_verified <lgl>,
#> #   pronunciation <chr>, mlb_debut_date <chr>, name_first_last <chr>, …
# }