Skip to contents

MLB Leagues

Usage

mlb_league(seasons = NULL, sport_id = NULL, league_id = NULL)

Arguments

seasons

Year(s) to return to return league information for.

sport_id

The sport_id to return league information for.

league_id

The league_id(s) to return league information for.

Value

Returns a tibble with the following columns

col_nametypes
leader_typecharacter

Examples

# \donttest{
  try(mlb_league(seasons = 2021, sport_id = 1))
#> ── MLB League data from MLB.com ───────────────────── baseballr 1.6.0 ──
#>  Data updated: 2024-04-13 21:56:31 UTC
#> # A tibble: 4 × 40
#>   league_id league_name       league_link        league_abbreviation
#>       <int> <chr>             <chr>              <chr>              
#> 1       103 American League   /api/v1/league/103 AL                 
#> 2       104 National League   /api/v1/league/104 NL                 
#> 3       114 Cactus League     /api/v1/league/114 CL                 
#> 4       115 Grapefruit League /api/v1/league/115 GL                 
#> # ℹ 36 more variables: league_name_short <chr>,
#> #   league_season_state <chr>, league_has_wild_card <lgl>,
#> #   league_has_split_season <lgl>, league_num_games <int>,
#> #   league_has_playoff_points <lgl>, league_num_teams <int>,
#> #   league_num_wildcard_teams <int>, league_season <chr>,
#> #   league_org_code <chr>, league_conferences_in_use <lgl>,
#> #   league_divisions_in_use <lgl>, league_sort_order <int>, …
# }