Acquiring and Analyzing Baseball Data
baseballr: Acquiring and Analyzing Baseball Data
(legacy) Scrape Batter Game Logs from FanGraphs
Baseball Reference Functions Overview
Scrape Batter Performance Data Over a Custom Time Frame
Scrape Pitcher Performance Data Over a Custom Time Frame
Scrape MLB Standings on a Given Date
Scrape Team Results
Chadwick Bureau Register Player Lookup
Check Chadwick installation
Look up Baseball Player IDs by Player Name
Download the Chadwick Bureau's public register of baseball players
Look up Baseball Player Name by ID
Helper for determining whether a batted ball is a "barrel"
Load .csv / .csv.gz file from a remote connection
(legacy) Scrape Batter Performance Data Over a Custom Time Frame
(legacy) Scrape Pitcher Performance Data Over a Custom Time Frame
Edge Code
Edge Percentage Frequency
FanGraphs Functions Overview
(legacy) Scrape Batter Leaderboards from FanGraphs
Scrape Batter Game Logs from FanGraphs
Scrape Batter Leaderboards from FanGraphs
Scrape Fielder Leaderboards from FanGraphs
Scrape FanGraphs.com Guts!
Scrape MiLB game logs for batters from FanGraphs
Scrape MiLB game logs for pitchers from FanGraphs
Scrape Park Factors from FanGraphs
(legacy) Scrape Pitcher Leaderboards from FanGraphs
Scrape Pitcher Game Logs from FanGraphs
Scrape Pitcher Leaderboards from FanGraphs
Scrape Team Batter Leaderboards from FanGraphs
Scrape Team Fielder Leaderboards from FanGraphs
Scrape Team Pitcher Leaderboards from FanGraphs
Calculate FIP and related metrics for any set of data
(legacy) Retrieve batting orders for a given MLB game
(legacy) Retrieve draft pick information by year
(legacy) Retrieve additional game information for major and minorleagu...
(legacy) Download a data frame of supplemental data about MLB gamessin...
(legacy) Get MLB Game Info by Date and Level
(legacy) Get Play-By-Play Data for NCAA Baseball Games
(legacy) Get NCAA Baseball Rosters
(legacy) Get NCAA Baseball Game Logs
(legacy) Retrieve lineups for a given NCAA game via its ‘game_info_url...
(legacy) Get Park Effects for NCAA Baseball Teams
(legacy) Get Schedule and Results for NCAA Baseball Teams
(legacy) Acquire pitch-by-pitch data for Major and Minor League games
(legacy) Retrieve probable starters for a given MLB game
(legacy) Get, Parse, and Format Retrosheet Event and Roster Files
(legacy) Download a data frame of all umpires and their MLBAM IDs forg...
Generate spray charts with ggplot2
Label Statcast data as imputed
Generate linear weight values for events using Baseball Savant data
Download a data frame of supplemental data about MLB games since 2008.
Load cleaned NCAA baseball play-by-play data from the baseballr datare...
Load cleaned NCAA baseball schedule from the baseballr data repo
Load cleaned NCAA men's college baseball season IDs from the baseballr...
Load cleaned NCAA men's college baseball teams from the baseballr data...
Download a data frame of all umpires and their mlbamids for games sinc...
Metrics Functions Overview
(legacy) Scrape MiLB game logs for batters from FanGraphs
(legacy) Scrape MiLB game logs for pitchers from FanGraphs
MLB Functions Overview
Find MLB All-Star Ballots
Find MLB All-Star Final Vote
Find MLB All-Star Write-ins
MLB Attendance
MLB All-Star, Awards, Home Run Derby Functions
MLB Awards
MLB Award Recipients
MLB Baseball Stats
Retrieve batting orders for a given MLB game
View all PCL conferences
MLB Divisions
Retrieve draft pick information by year
Retrieve latest draft information by year
Retrieve draft prospect information by year
MLB Event Types
MLB Fielder Detail Types
Acquire time codes for Major and Minor League games
Retrieve additional game content for major and minor league games
Acquire game context metrics for Major and Minor League games
Retrieve additional game information for major and minor league games
Retrieve game linescores for major and minor league games
Retrieve game pace metrics for major and minor league
Get MLB Game Info by Date and Level
MLB Game Status Codes
Acquire time codes for Major and Minor League games
MLB Game Types
Acquire win probability for Major and Minor League games
Acquire high/low stats for Major and Minor Leagues
MLB Stat High/Low Types
MLB Hit Trajectories
Retrieve Homerun Derby data
Retrieve Homerun Derby Bracket
Retrieve Homerun Derby Players
MLB Job Types
MLB Jobs
MLB Jobs Datacasters
MLB Jobs Official Scorers
MLB Jobs Umpires
MLB API Language Options
MLB Leagues
MLB League Leader Types
MLB Logical Events
MLB Metrics
Acquire pitch-by-pitch data for Major and Minor League games
Acquire pitch-by-pitch data between two timecodes for Major and MinorL...
Find Biographical Information for MLB Players
Find Information About MLB Free Agents
MLB Pitch Codes
MLB Pitch Types
Find MLB Player Game Stats
Find MLB Player Game Stats - Current Game
MLB Player Status Codes
MLB Positions
Retrieve probable starters for a given MLB game
MLB Review Reasons
MLB Roster Types
Find MLB Rosters by Roster Type
MLB Runner Detail Types
Find game_pk values for professional baseball games (major and minorle...
MLB Schedule Event Types
Find game_pk values for professional baseball games (major and minorle...
Find game_pk values for professional baseball postseason games (majora...
Find game_pk values for professional baseball postseason series games(...
Find MLB Seasons
Find MLB Seasons all
MLB Situation Codes
MLB Sky (Weather) Codes
MLB Sport IDs
MLB Sport IDs Information
MLB Sport Players
MLB Standings
MLB Standings Types
MLB Stat Groups
MLB Stat Types
MLB Stats
MLB Stats Leaders
MLB Team Affiliates
MLB Team Alumni
MLB Team Coaches
MLB Teams History
MLB Team Info
MLB Team Leaders
MLB Team Personnel
MLB Team Individual Stats
MLB Teams
MLB Teams Stats
MLB Teams Stats Leaders
Find MLB Venues
MLB Wind Direction Codes
Most Recent MLB Season
Most Recent NCAA Baseball Season
NCAA Functions Overview
Get NCAA Baseball Game Logs
Retrieve lineups for a given NCAA game via its ‘game_info_url’
Get Park Effects for NCAA Baseball Teams
Get Play-By-Play Data for NCAA Baseball Games
Get NCAA Baseball Rosters
Get Schedule and Results for NCAA Baseball Teams
Lookup NCAA baseball school IDs (Division I, II, and III)
(legacy) Scrape NCAA baseball Team Player Stats (Division I, II, andII...
Scrape NCAA baseball Team Player Stats (Division I, II, and III)
Scrape NCAA baseball Teams (Division I, II, and III)
(legacy) Scrape Pitcher Game Logs from FanGraphs
Process Baseball Savant CSV payload
Progressively
Load .rds file from a remote connection
Retry http request with proxy
Get, Parse, and Format Retrosheet Event and Roster Files
Generate run expectancy and related measures from Baseball Savant data
(legacy) Lookup NCAA baseball school IDs (Division I, II, and III)
(legacy) Query Baseball Savant Leaderboards
(legacy) Query Statcast by Date Range and Players
Scrape League Payroll Breakdowns from Spotrac
Scrape Team Active Payroll Breakdown from Spotrac
(legacy) Scrape MLB Standings on a Given Date
Statcast Functions Overview
Query Baseball Savant Leaderboards
Query Statcast by Date Range and Players
Create stat lines from Statcast data
Calculate Team-level Consistency
(legacy) Scrape Team Results
Calculate wOBA and related metrics for any set of data
Provides numerous utilities for acquiring and analyzing baseball data from online sources such as 'Baseball Reference' <https://www.baseball-reference.com/>, 'FanGraphs' <https://www.fangraphs.com/>, and the 'MLB Stats' API <https://www.mlb.com/>.
Useful links