Skip to contents

MLB Situation Codes

Usage

mlb_situation_codes()

Value

Returns a tibble with the following columns

col_nametypesdescription
situation_codecharacterCode identifying the game situation.
sort_orderintegerDisplay sort order for the situation code.
navigation_menucharacterNavigation menu grouping (e.g. 'Game').
situation_code_descriptioncharacterDescription of the situation (e.g. 'Home Games').
teamlogicalWhether the situation applies to team stats.
battinglogicalWhether the situation applies to batting stats.
fieldinglogicalWhether the situation applies to fielding stats.
pitchinglogicalWhether the situation applies to pitching stats.

Examples

# \donttest{
  try(mlb_situation_codes())
#> ── MLB Situation Codes data from MLB.com ──────────── baseballr 2.0.0 ──
#>  Data updated: 2026-06-12 14:09:52 UTC
#> # A tibble: 602 × 8
#>    situation_code sort_order navigation_menu situation_code_description
#>    <chr>               <int> <chr>           <chr>                     
#>  1 h                       1 Game            Home Games                
#>  2 a                       2 Game            Away Games                
#>  3 d                       3 Game            Day Games                 
#>  4 n                       4 Game            Night Games               
#>  5 g                       5 Game            On Grass                  
#>  6 t                       6 Game            On Turf                   
#>  7 2                      20 Month           February                  
#>  8 3                      21 Month           March                     
#>  9 4                      22 Month           April                     
#> 10 5                      23 Month           May                       
#> # ℹ 592 more rows
#> # ℹ 4 more variables: team <lgl>, batting <lgl>, fielding <lgl>,
#> #   pitching <lgl>
# }