Skip to contents

Baseball Savant

Baseball Savant MLB Data Functions

Functions exported by baseballr to access Baseball Savant MLB Data

statcast
Statcast Functions Overview
statcast_leaderboards()
Query Baseball Savant Leaderboards
statcast_search() statcast_search.default() statcast_search_batters() statcast_search_pitchers()
Query Statcast by Date Range and Players

Baseball Savant Helpers

Baseball Savant MLB Helper Functions

Functions exported by baseballr to process Baseball Savant MLB Data

edge_code()
Edge Code
edge_frequency()
Edge Percentage Frequency
code_barrel()
Helper for determining whether a batted ball is a "barrel"
process_statcast_payload()
Process Baseball Savant CSV payload
statline_from_statcast()
Create stat lines from Statcast data
label_statcast_imputed_data()
Label Statcast data as imputed
linear_weights_savant()
Generate linear weight values for events using Baseball Savant data

baseballr Data Repository - NCAA

baseballr Data Repository NCAA Functions

Functions exported by baseballr to access baseballr data repository NCAA data

load_ncaa_baseball_teams()
Load cleaned NCAA men's college baseball teams from the baseballr data repo
load_ncaa_baseball_schedule()
Load cleaned NCAA baseball schedule from the baseballr data repo
load_ncaa_baseball_pbp()
Load cleaned NCAA baseball play-by-play data from the baseballr data repo
load_ncaa_baseball_season_ids()
Load cleaned NCAA men's college baseball season IDs from the baseballr data repo

NCAA Baseball

NCAA Baseball Data Functions

Functions exported by baseballr to access NCAA Baseball Data

ncaa
NCAA Functions Overview
ncaa_schedule_info()
Get Schedule and Results for NCAA Baseball Teams
ncaa_roster()
Get NCAA Baseball Rosters
ncaa_game_logs()
Get NCAA Baseball Game Logs
ncaa_lineups()
Retrieve lineups for a given NCAA game via its game_info_url
ncaa_park_factor()
Get Park Effects for NCAA Baseball Teams
ncaa_school_id_lu()
Lookup NCAA baseball school IDs (Division I, II, and III)
ncaa_teams()
Scrape NCAA baseball Teams (Division I, II, and III)
ncaa_team_player_stats()
Scrape NCAA baseball Team Player Stats (Division I, II, and III)
ncaa_pbp()
Get Play-By-Play Data for NCAA Baseball Games

Retrosheet

Retrosheet Data Functions

Functions exported by baseballr to access Retrosheet Data

retrosheet_data()
Get, Parse, and Format Retrosheet Event and Roster Files

FanGraphs

FanGraphs MLB and MiLB Data Functions

Functions exported by baseballr to access FanGraphs’ MLB and MiLB Data

fangraphs
FanGraphs Functions Overview
fg_park() fg_park_hand()
Scrape Park Factors from FanGraphs
fg_guts()
Scrape FanGraphs.com Guts!
fg_batter_game_logs()
Scrape Batter Game Logs from FanGraphs
fg_batter_leaders()
Scrape Batter Leaderboards from FanGraphs
fg_pitcher_game_logs()
Scrape Pitcher Game Logs from FanGraphs
fg_pitcher_leaders()
Scrape Pitcher Leaderboards from FanGraphs
fg_fielder_leaders()
Scrape Fielder Leaderboards from FanGraphs
fg_milb_batter_game_logs()
Scrape MiLB game logs for batters from FanGraphs
fg_milb_pitcher_game_logs()
Scrape MiLB game logs for pitchers from FanGraphs
fg_team_batter()
Scrape Team Batter Leaderboards from FanGraphs
fg_team_fielder()
Scrape Team Fielder Leaderboards from FanGraphs
fg_team_pitcher()
Scrape Team Pitcher Leaderboards from FanGraphs

Baseball Reference

Baseball Reference MLB Data Functions

Functions exported by baseballr to access Baseball Reference’s MLB Data

bref
Baseball Reference Functions Overview
bref_daily_batter()
Scrape Batter Performance Data Over a Custom Time Frame
bref_daily_pitcher()
Scrape Pitcher Performance Data Over a Custom Time Frame
bref_standings_on_date()
Scrape MLB Standings on a Given Date
bref_team_results()
Scrape Team Results

Chadwick Bureau Player Lookup

Chadwick Bureau Player Lookup Functions

Functions exported by baseballr to access baseball player information from the Chadwick Bureau’s Public Register of Baseball Players

chadwick
Chadwick Bureau Register Player Lookup
chadwick_path() chadwick_is_installed() chadwick_find_lib() chadwick_set_ld_library_path() chadwick_ld_library_path()
Check Chadwick installation
chadwick_player_lu() get_chadwick_lu()
Download the Chadwick Bureau's public register of baseball players
playerid_lookup()
Look up Baseball Player IDs by Player Name
playername_lookup()
Look up Baseball Player Name by ID

Spotrac

MLB Contracts Data functions

Functions exported by baseballr to access Spotrac Contracts Data

sptrc_league_payrolls()
Scrape League Payroll Breakdowns from Spotrac
sptrc_team_active_payroll()
Scrape Team Active Payroll Breakdown from Spotrac

MLB Stats - Overview

mlb
MLB Functions Overview

MLB Stats - Types and Codes

MLB Stats - Types and Codes Data Functions

Functions exported by baseballr to access MLB Stats - Types and Codes Data

mlb_baseball_stats()
MLB Baseball Stats
mlb_event_types()
MLB Event Types
mlb_fielder_detail_types()
MLB Fielder Detail Types
mlb_high_low_types()
MLB Stat High/Low Types
mlb_hit_trajectories()
MLB Hit Trajectories
mlb_game_types()
MLB Game Types
mlb_job_types()
MLB Job Types
mlb_league_leader_types()
MLB League Leader Types
mlb_languages()
MLB API Language Options
mlb_logical_events()
MLB Logical Events
mlb_metrics()
MLB Metrics
mlb_pitch_codes()
MLB Pitch Codes
mlb_pitch_types()
MLB Pitch Types
mlb_positions()
MLB Positions
mlb_review_reasons()
MLB Review Reasons
mlb_roster_types()
MLB Roster Types
mlb_runner_detail_types()
MLB Runner Detail Types
mlb_schedule_event_types()
MLB Schedule Event Types
mlb_seasons()
Find MLB Seasons
mlb_seasons_all()
Find MLB Seasons all
mlb_situation_codes()
MLB Situation Codes
mlb_sky()
MLB Sky (Weather) Codes
mlb_standings_types()
MLB Standings Types
mlb_stat_groups()
MLB Stat Groups
mlb_stat_types()
MLB Stat Types
mlb_wind_direction_codes()
MLB Wind Direction Codes

MLB Stats - Game

MLB Stats - Game Data Functions

Functions exported by baseballr to access MLB Stats - Game Data

mlb_attendance()
MLB Attendance
mlb_game_changes()
Acquire time codes for Major and Minor League games
mlb_game_content()
Retrieve additional game content for major and minor league games
mlb_game_context_metrics()
Acquire game context metrics for Major and Minor League games
mlb_game_info()
Retrieve additional game information for major and minor league games
mlb_game_linescore()
Retrieve game linescores for major and minor league games
mlb_game_pace()
Retrieve game pace metrics for major and minor league
mlb_game_pks()
Get MLB Game Info by Date and Level
mlb_game_status_codes()
MLB Game Status Codes
mlb_game_timecodes()
Acquire time codes for Major and Minor League games
mlb_game_types()
MLB Game Types
mlb_game_wp()
Acquire win probability for Major and Minor League games
mlb_pbp()
Acquire pitch-by-pitch data for Major and Minor League games
mlb_pbp_diff()
Acquire pitch-by-pitch data between two timecodes for Major and Minor League games
mlb_probables()
Retrieve probable starters for a given MLB game
mlb_batting_orders()
Retrieve batting orders for a given MLB game
mlb_schedule()
Find game_pk values for professional baseball games (major and minor leagues)
mlb_schedule_event_types()
MLB Schedule Event Types
mlb_schedule_games_tied()
Find game_pk values for professional baseball games (major and minor leagues) that are tied
mlb_schedule_postseason()
Find game_pk values for professional baseball postseason games (major and minor leagues)
mlb_schedule_postseason_series()
Find game_pk values for professional baseball postseason series games (major and minor leagues)
mlb_venues()
Find MLB Venues

MLB Stats - Players

MLB Stats - Player Data Functions

Functions exported by baseballr to access MLB Stats - Player Data

mlb_player_game_stats()
Find MLB Player Game Stats
mlb_player_game_stats_current()
Find MLB Player Game Stats - Current Game
mlb_player_status_codes()
MLB Player Status Codes
mlb_people()
Find Biographical Information for MLB Players
mlb_people_free_agents()
Find Information About MLB Free Agents
mlb_high_low_stats()
Acquire high/low stats for Major and Minor Leagues
mlb_stats()
MLB Stats
mlb_stats_leaders()
MLB Stats Leaders

MLB Stats - Teams

MLB Stats - Teams Data Functions

Functions exported by baseballr to access MLB Stats - Teams Data

mlb_team_affiliates()
MLB Team Affiliates
mlb_team_alumni()
MLB Team Alumni
mlb_team_coaches()
MLB Team Coaches
mlb_team_history()
MLB Teams History
mlb_team_info()
MLB Team Info
mlb_team_leaders()
MLB Team Leaders
mlb_team_personnel()
MLB Team Personnel
mlb_team_stats()
MLB Team Individual Stats
mlb_teams()
MLB Teams
mlb_teams_stats()
MLB Teams Stats
mlb_teams_stats_leaders()
MLB Teams Stats Leaders
mlb_rosters()
Find MLB Rosters by Roster Type

MLB Stats - Standings

MLB Stats - Standings Data Functions

Functions exported by baseballr to access MLB Stats - Standings Data

mlb_standings()
MLB Standings
mlb_standings_types()
MLB Standings Types

MLB Stats - League

MLB Stats - League Data Functions

Functions exported by baseballr to access MLB Stats - League Data

mlb_league()
MLB Leagues
mlb_league_leader_types()
MLB League Leader Types
mlb_conferences()
View all PCL conferences
mlb_divisions()
MLB Divisions
mlb_sports()
MLB Sport IDs
mlb_sports_info()
MLB Sport IDs Information
mlb_sports_players()
MLB Sport Players

MLB Stats - Draft

MLB Stats - Draft Data Functions

Functions exported by baseballr to access MLB Stats - Draft Data

mlb_draft()
Retrieve draft pick information by year
mlb_draft_latest()
Retrieve latest draft information by year
mlb_draft_prospects()
Retrieve draft prospect information by year

MLB Stats - Awards

MLB Stats - Awards Data Functions

Functions exported by baseballr to access MLB Stats - Awards Data

mlb_award
MLB All-Star, Awards, Home Run Derby Functions
mlb_awards()
MLB Awards
mlb_awards_recipient()
MLB Award Recipients
mlb_all_star_ballots()
Find MLB All-Star Ballots
mlb_all_star_final_vote()
Find MLB All-Star Final Vote
mlb_all_star_write_ins()
Find MLB All-Star Write-ins
mlb_homerun_derby()
Retrieve Homerun Derby data
mlb_homerun_derby_bracket()
Retrieve Homerun Derby Bracket
mlb_homerun_derby_players()
Retrieve Homerun Derby Players

MLB Stats - Jobs

MLB Stats - Jobs Data Functions

Functions exported by baseballr to access MLB Stats - Jobs Data

mlb_job_types()
MLB Job Types
mlb_jobs()
MLB Jobs
mlb_jobs_datacasters()
MLB Jobs Datacasters
mlb_jobs_official_scorers()
MLB Jobs Official Scorers
mlb_jobs_umpires()
MLB Jobs Umpires

baseballr Data Repository Misc. Lookup

baseballr Data Repository Misc. Lookup Functions

Functions exported by baseballr to access baseballr data repository supplementary data

load_umpire_ids()
Download a data frame of all umpires and their mlbamids for games since 2008
load_game_info_sup()
Download a data frame of supplemental data about MLB games since 2008.

Metrics

Metrics Functions

Functions exported by baseballr to calculate metrics

metrics
Metrics Functions Overview
woba_plus()
Calculate wOBA and related metrics for any set of data
fip_plus()
Calculate FIP and related metrics for any set of data
team_consistency()
Calculate Team-level Consistency
run_expectancy_code()
Generate run expectancy and related measures from Baseball Savant data

Visualizations

Visualizations Functions

Functions exported by baseballr to create visuals

ggspraychart()
Generate spray charts with ggplot2

Included Data

Included baseballr data

Data exported by baseballr for ease of use

column_structure_draft_mlb
Column structure of the MLB Draft data
teams_lu_table
A Team Lookup Table
stats_api_live_empty_df
Column structure of MLB Stats Live Game API data frame
statcast_impute
Statcast Label Imputation

Utilities

Internal utilities of baseballr

most_recent_mlb_season()
Most Recent MLB Season
most_recent_ncaa_baseball_season()
Most Recent NCAA Baseball Season
csv_from_url()
Load .csv / .csv.gz file from a remote connection
rds_from_url()
Load .rds file from a remote connection
progressively()
Progressively
request_with_proxy()
Retry http request with proxy

Legacy

Legacy Functions

Functions superseded by new naming convention

batter_game_logs_fg()
(legacy) Scrape Batter Game Logs from FanGraphs
daily_batter_bref()
(legacy) Scrape Batter Performance Data Over a Custom Time Frame
daily_pitcher_bref()
(legacy) Scrape Pitcher Performance Data Over a Custom Time Frame
fg_bat_leaders()
(legacy) Scrape Batter Leaderboards from FanGraphs
fg_pitch_leaders()
(legacy) Scrape Pitcher Leaderboards from FanGraphs
get_batting_orders()
(legacy) Retrieve batting orders for a given MLB game
get_draft_mlb()
(legacy) Retrieve draft pick information by year
get_game_info_mlb()
(legacy) Retrieve additional game information for major and minor league games
get_game_info_sup_petti()
(legacy) Download a data frame of supplemental data about MLB games since 2008.
get_game_pks_mlb()
(legacy) Get MLB Game Info by Date and Level
get_ncaa_baseball_pbp() ncaa_baseball_pbp()
(legacy) Get Play-By-Play Data for NCAA Baseball Games
ncaa_baseball_roster() get_ncaa_baseball_roster()
(legacy) Get NCAA Baseball Rosters
get_ncaa_game_logs()
(legacy) Get NCAA Baseball Game Logs
get_ncaa_lineups()
(legacy) Retrieve lineups for a given NCAA game via its game_info_url
get_ncaa_park_factor()
(legacy) Get Park Effects for NCAA Baseball Teams
get_ncaa_schedule_info()
(legacy) Get Schedule and Results for NCAA Baseball Teams
get_pbp_mlb()
(legacy) Acquire pitch-by-pitch data for Major and Minor League games
get_probables_mlb()
(legacy) Retrieve probable starters for a given MLB game
get_retrosheet_data()
(legacy) Get, Parse, and Format Retrosheet Event and Roster Files
get_umpire_ids_petti()
(legacy) Download a data frame of all umpires and their MLBAM IDs for games since 2008
milb_batter_game_logs_fg()
(legacy) Scrape MiLB game logs for batters from FanGraphs
milb_pitcher_game_logs_fg()
(legacy) Scrape MiLB game logs for pitchers from FanGraphs
ncaa_scrape()
(legacy) Scrape NCAA baseball Team Player Stats (Division I, II, and III)
pitcher_game_logs_fg()
(legacy) Scrape Pitcher Game Logs from FanGraphs
school_id_lu()
(legacy) Lookup NCAA baseball school IDs (Division I, II, and III)
scrape_savant_leaderboards()
(legacy) Query Baseball Savant Leaderboards
scrape_statcast_savant() scrape_statcast_savant.Date() scrape_statcast_savant.default() scrape_statcast_savant_batter() scrape_statcast_savant_batter_all() scrape_statcast_savant_pitcher() scrape_statcast_savant_pitcher_all()
(legacy) Query Statcast by Date Range and Players
standings_on_date_bref()
(legacy) Scrape MLB Standings on a Given Date
team_results_bref()
(legacy) Scrape Team Results