Skip to contents

MLB Team Leaders

Usage

mlb_team_leaders(
  team_id = NULL,
  leader_categories = NULL,
  leader_game_types = NULL,
  season = NULL,
  limit = 1000
)

Arguments

team_id

Team ID to return team leader information for.

leader_categories

Team leader category to return information and ranking for a particular statistic.

leader_game_types

Game type to return information and ranking for a particular statistic in a particular game type.

season

Season to return team leader information for.

limit

A limit to limit return to a particular number of records.

Value

Returns a tibble with the following columns

col_nametypesdescription
leader_categorycharacterTeam leader category (e.g., homeRuns).
rankintegerRank within the team leaderboard.
valuecharacterStatistic value for the leader.
seasoncharacterSeason year.
team_idintegerTeam MLBAM ID.
team_namecharacterTeam name.
team_linkcharacterAPI link to the team.
league_idintegerLeague MLBAM ID.
league_namecharacterLeague name.
league_linkcharacterAPI link to the league.
person_idintegerPlayer MLBAM ID.
person_full_namecharacterPlayer full name.
person_linkcharacterAPI link to the player.
person_first_namecharacterPlayer first name.
person_last_namecharacterPlayer last name.
sport_idintegerSport MLBAM ID.
sport_linkcharacterAPI link to the sport.
sport_abbreviationcharacterSport abbreviation (e.g., MLB).
stat_groupcharacterStat group (e.g., hitting).
total_splitsintegerTotal number of splits in the leaderboard.
game_type_idcharacterGame type code (e.g., R for regular season).
game_type_descriptioncharacterGame type description.

Examples

# \donttest{
  try(mlb_team_leaders(team_id = 137, leader_categories = "homeRuns", season = 2021))
#> ── MLB Team Leaders data from MLB.com ─────────────── baseballr 2.0.0 ──
#>  Data updated: 2026-06-12 14:09:57 UTC
#> # A tibble: 52 × 22
#>    leader_category  rank value season team_id team_name        team_link
#>    <chr>           <int> <chr> <chr>    <int> <chr>            <chr>    
#>  1 homeRuns            1 29    2021       137 San Francisco G… /api/v1/…
#>  2 homeRuns            2 25    2021       137 San Francisco G… /api/v1/…
#>  3 homeRuns            3 24    2021       137 San Francisco G… /api/v1/…
#>  4 homeRuns            4 18    2021       137 San Francisco G… /api/v1/…
#>  5 homeRuns            4 18    2021       137 San Francisco G… /api/v1/…
#>  6 homeRuns            4 18    2021       137 San Francisco G… /api/v1/…
#>  7 homeRuns            7 16    2021       137 San Francisco G… /api/v1/…
#>  8 homeRuns            8 13    2021       137 San Francisco G… /api/v1/…
#>  9 homeRuns            8 13    2021       137 San Francisco G… /api/v1/…
#> 10 homeRuns           10 12    2021       137 San Francisco G… /api/v1/…
#> # ℹ 42 more rows
#> # ℹ 15 more variables: league_id <int>, league_name <chr>,
#> #   league_link <chr>, person_id <int>, person_full_name <chr>,
#> #   person_link <chr>, person_first_name <chr>, person_last_name <chr>,
#> #   sport_id <int>, sport_link <chr>, sport_abbreviation <chr>,
#> #   stat_group <chr>, total_splits <int>, game_type_id <chr>,
#> #   game_type_description <chr>
# }