Skip to contents

Acquire high/low stats for Major and Minor Leagues

Usage

mlb_high_low_stats(
  org_type,
  season,
  sort_stat,
  team_ids = NULL,
  league_ids = NULL,
  sport_ids = NULL,
  game_type = NULL,
  stat_group = NULL,
  limit = NULL
)

Arguments

org_type

The organization type for return information (Required). Valid values include:

  • player

  • team

  • division

  • league

  • sport

season

The season for which you want to return information (Required).

sort_stat

The stat to sort the return (Required). Valid values can be found from 'stat_lookup_param' below

stat_namestat_lookup_paramis_countingstat_labelstat_groupsorg_typeshigh_low_types
at_batsatBatsTRUEAt batshitting , pitchingPLAYER, TEAMPLAYER, TEAM , GAME
total_plate_appearancesplateAppearancesTRUETotal plate appearanceshittingPLAYER, TEAMPLAYER, TEAM , GAME
runsrunsTRUERunshittingPLAYER, TEAMPLAYER, TEAM , GAME
runs_batted_inrbiTRUERuns batted inhittingPLAYER, TEAMPLAYER, TEAM , GAME
home_team_runsrunsTRUEHome team runshittingTEAMGAME
away_team_runsrunsTRUEAway team runshittingTEAMGAME
hitshitsTRUEHitshittingPLAYER, TEAMPLAYER, TEAM , GAME
hits_risphitsRispTRUEHits risphittingPLAYER, TEAMPLAYER, TEAM
home_team_hitshitsTRUEHome team hitshittingTEAMGAME
away_team_hitshitsTRUEAway team hitshittingTEAMGAME
total_basestotalBasesTRUETotal baseshitting , pitchingPLAYER, TEAMPLAYER, TEAM
doublesdoublesTRUEDoubleshitting , pitchingPLAYER, TEAMPLAYER, TEAM , GAME
triplestriplesTRUETripleshittingPLAYER, TEAMPLAYER, TEAM , GAME
home_runshomeRunsTRUEHome runshitting , pitchingPLAYER, TEAMPLAYER, TEAM
extra_base_hitsextraBaseHitsTRUEExtra base hitshittingPLAYER, TEAMPLAYER, TEAM
walksbaseOnBallsTRUEWalkshitting , pitchingPLAYER, TEAMPLAYER, TEAM
strikeoutsstrikeoutsTRUEStrikeoutshitting , pitchingPLAYER, TEAMPLAYER, TEAM
stolen_basesstolenBasesTRUEStolen baseshittingPLAYER, TEAMPLAYER, TEAM
caught_stealingcaughtStealingTRUECaught stealinghitting , pitching, fieldingPLAYER, TEAMPLAYER, TEAM
sacrifice_fliessacFliesTRUESacrifice flieshittingPLAYER, TEAMPLAYER, TEAM
sacrifice_buntssacBuntsTRUESacrifice buntshittingPLAYER, TEAMPLAYER, TEAM
hit_by_pitcheshitByPitchTRUEHit by pitcheshitting , pitchingPLAYER, TEAMPLAYER, TEAM
left_on_baseleftOnBaseTRUELeft on basehittingPLAYER, TEAMPLAYER, TEAM
ground_into_double_playsgroundIntoDoublePlayTRUEGround into double playshitting , pitchingPLAYER, TEAMPLAYER, TEAM
strikesstrikesTRUEStrikespitchingPLAYER, TEAMPLAYER, TEAM , GAME
pitchespitchesThrownTRUEPitchespitchingPLAYER, TEAMPLAYER, TEAM , GAME
balksbalksTRUEBalkspitchingPLAYER, TEAMPLAYER, TEAM , GAME
innings_pitchedinningsPitchedTRUEInnings pitchedpitchingPLAYERPLAYER
errorserrorsTRUEErrorsfieldingTEAM
home_team_errorserrorsTRUEHome team errorsfieldingTEAM
away_team_errorserrorsTRUEAway team errorsfieldingTEAM
chanceschancesTRUEChancesfieldingTEAM
put_outsputOutsTRUEPut outsfieldingTEAM
assistsassistsTRUEAssistsfieldingTEAM
double_playsdoublePlaysTRUEDouble playsfieldingTEAM
attendanceattendanceTRUEAttendancegameTEAMGAME
game_timegameDurationTRUEGame timegameTEAMGAME
delay_timegameDurationTRUEDelay timegameTEAMGAME
longestgameDurationTRUELongestgameTEAM
shortestgameDurationTRUEShortestgameTEAM
inninginningsTRUEInninggameTEAMGAME
win_streakwinStreakTRUEWin streakstreakTEAM
loss_streaklossStreakTRUELoss streakstreakTEAM
team_ids

The team_id(s) for which to return information.

league_ids

The league_id(s) for which to return information.

sport_ids

The sport_id(s) for which to return information.

game_type

The game_type for which to return information.

stat_group

Stat group for which to return information. Valid values include:

stat_group
hitting
pitching
fielding
catching
running
game
team
streak
limit

Number of records as the limit of the return.

Value

Returns a tibble with the following columns

col_nametypes
total_splitsinteger
seasoninteger
datecharacter
is_homelogical
rankinteger
game_inningsinteger
stat_at_batsinteger
team_idinteger
team_namecharacter
team_linkcharacter
opponent_idinteger
opponent_namecharacter
opponent_linkcharacter
game_pkinteger
game_linkcharacter
game_numberinteger
game_content_linkcharacter
home_team_idinteger
home_team_namecharacter
home_team_linkcharacter
away_team_idinteger
away_team_namecharacter
away_team_linkcharacter
combined_statslogical
group_display_namecharacter
game_type_idcharacter
game_type_descriptioncharacter
sort_stat_namecharacter
sort_stat_lookup_paramcharacter
sort_stat_is_countinglogical
sort_stat_labelcharacter

Examples

# \donttest{
  try(mlb_high_low_stats(org_type = 'Team', season = 2020, sort_stat = 'atBats'))
#> ── MLB High Low Stats data from MLB.com ───────────── baseballr 1.2.0 ──
#>  Data updated: 2022-04-30 07:16:08 UTC
#> # A tibble: 20 × 32
#>    total_splits season date      is_home  rank game_innings stat_at_bats
#>           <int>  <int> <chr>     <lgl>   <int>        <int>        <int>
#>  1           31   2020 2020-09-… FALSE       1            9           52
#>  2           31   2020 2020-09-… FALSE       2           12           49
#>  3           31   2020 2020-08-… FALSE       2            9           49
#>  4           31   2020 2020-08-… FALSE       2           11           49
#>  5           31   2020 2020-09-… FALSE       2            9           49
#>  6           30   2020 2020-08-… FALSE       1           11           96
#>  7           30   2020 2020-09-… FALSE       2           12           94
#>  8           30   2020 2020-08-… FALSE       3           11           91
#>  9           30   2020 2020-08-… FALSE       4           13           90
#> 10           30   2020 2020-08-… FALSE       4            9           90
#> 11           31   2020 2020-09-… TRUE        1            9           52
#> 12           31   2020 2020-08-… TRUE        2            9           49
#> 13           31   2020 2020-08-… TRUE        3           11           49
#> 14           31   2020 2020-09-… TRUE        4           12           49
#> 15           31   2020 2020-09-… TRUE        5            9           49
#> 16           30   2020 2020-08-… FALSE       1           11           96
#> 17           30   2020 2020-09-… FALSE       2           12           94
#> 18           30   2020 2020-08-… FALSE       3           11           91
#> 19           30   2020 2020-08-… FALSE       4           13           90
#> 20           30   2020 2020-08-… FALSE       5            9           90
#> # … with 25 more variables: team_id <int>, team_name <chr>,
#> #   team_link <chr>, opponent_id <int>, opponent_name <chr>,
#> #   opponent_link <chr>, game_pk <int>, game_link <chr>,
#> #   game_number <int>, game_day_night <chr>, game_content_link <chr>,
#> #   home_team_id <int>, home_team_name <chr>, home_team_link <chr>,
#> #   away_team_id <int>, away_team_name <chr>, away_team_link <chr>,
#> #   combined_stats <lgl>, group_display_name <chr>, …
# }