Learn R Programming

baseballr (version 1.5.0)

mlb_stats_leaders: MLB Stats Leaders

Description

MLB Stats Leaders

Usage

mlb_stats_leaders(
  leader_categories = NULL,
  player_pool = NULL,
  leader_game_types = NULL,
  sit_codes = NULL,
  position = NULL,
  stat_group = NULL,
  season = NULL,
  league_id = NULL,
  sport_id = NULL,
  start_date = NULL,
  end_date = NULL,
  stat_type = NULL,
  limit = 1000
)

Value

Returns a tibble with the following columns

col_nametypes
leader_categorycharacter
rankinteger
valuecharacter
seasoncharacter
num_teamsinteger
team_idinteger
team_namecharacter
team_linkcharacter
league_idinteger
league_namecharacter
league_linkcharacter
person_idinteger
person_full_namecharacter
person_linkcharacter
person_first_namecharacter
person_last_namecharacter
sport_idinteger
sport_linkcharacter
sport_abbreviationcharacter
stat_groupcharacter
total_splitsinteger
game_type_idcharacter
game_type_descriptioncharacter

Arguments

leader_categories

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

player_pool

There are 4 different types of player pools to return statistics for a particular player pool across a sport. Acceptable values include: All, Qualified, Rookies, or Qualified_rookies

leader_game_types

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

sit_codes

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

position

Position to return statistics for a given position. Default to "Qualified" player pool Acceptable values include:

  • P

  • C

  • 1B

  • 2B

  • 3B

  • SS

  • LF

  • CF

  • RF

  • DH

  • PH

  • PR

  • BR

  • OF

  • IF

  • SP

  • RP

  • CP

  • UT

  • UI

  • UO

  • RHP

  • LHP

  • RHS

  • LHS

  • LHR

  • RHR

  • B

  • X

stat_group

Stat group to return information and ranking for a particular statistic in a particular group.

season

Year to return information and ranking for a particular statistic in a given year.

league_id

League ID to return statistics for a given league. Default to "Qualified" player pool.

sport_id

The sport_id to return information and ranking information for.

start_date

Start date to return information and ranking for a particular statistic for a particular date range. Format: MM/DD/YYYY start_date must be coupled with end_date and byDateRange stat_type

end_date

End date to return information and ranking for a particular statistic for a particular date range. Format: MM/DD/YYYY end_date must be coupled with start_date and byDateRange stat_type

stat_type

The stat_type to return information and ranking for a particular statistic for a particular stat type.

limit

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

Examples

Run this code
# \donttest{
 try(mlb_stats_leaders(leader_categories='homeRuns',sport_id=1, season = 2021))
# }

Run the code above in your browser using DataLab