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.2.0 ──
#>  Data updated: 2022-04-30 07:16:15 UTC
#> # A tibble: 4 × 40
#>   league_id league_name    league_link league_abbrevia… league_name_sho…
#>       <int> <chr>          <chr>       <chr>            <chr>           
#> 1       103 American Leag… /api/v1/le… AL               American        
#> 2       104 National Leag… /api/v1/le… NL               National        
#> 3       114 Cactus League  /api/v1/le… CL               Cactus          
#> 4       115 Grapefruit Le… /api/v1/le… GL               Grapefruit      
#> # … with 35 more variables: 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>, league_active <lgl>, …
# }