Analyzing Baseball Data with R (3rd Edition)
by Jim Albert, Benjamin S. Baumer, Max Marchi · CRC Press (Chapman & Hall/CRC The R Series)
Textbook teaching sabermetrics through R and the tidyverse using Lahman, Retrosheet and Statcast data. Covers run expectancy, win probability, catcher framing, career trajectories, simulation and Shiny apps. Method-first: every chapter pairs a baseball question with reproducible code on real public data. The full third edition is readable free online.
More resources on Sports Analytics
Basketball on Paper: Rules and Tools for Performance Analysis
Foundational basketball analytics text introducing possession-based evaluation, offensive and defensive ratings, the Four Factors and individual credit for team results, with derivations of each method from box-score data.
Mathletics (2nd Edition)
Cross-sport book applying regression, probability and simulation to baseball, football, basketball, hockey, soccer and other sports. Covers player ratings, win probability, fourth-down and lineup decisions, point spreads and ranking systems, with worked spreadsheet examples. The best single cross-sport survey that teaches the actual calculations rather than narrating them.
A Beginner's Guide to nflfastR
Hands-on R tutorial for NFL play-by-play data: loading seasons with nflreadr, filtering and summarising plays, EPA and success rate, plotting with team logos, and building a regression model that predicts team win totals. Primary documentation from the toolmakers; the standard first step for NFL analysis and the most practical free starting point for that sport.
FanGraphs Sabermetrics Library
Reference library defining baseball's core analytic metrics, including wOBA, wRC+, FIP, xFIP, SIERA, UZR, DRS and WAR, with principles pages on sample size, regression to the mean, park factors and descriptive versus predictive statistics. The clearest free explanation of what each metric measures, how it is built and when to use it.
Friends of Tracking
Video lectures and coding tutorials recorded in 2020 by club and federation data scientists. Covers tracking data, pitch control, valuing passes and player actions, expected goals and how analysts work inside professional football clubs. Only free source where club practitioners teach tracking-data methods (Shaw's Metrica pitch-control series, Spearman's off-ball scoring). Complements Soccermatics, which is text-first.
Soccermatics: Mathematical Modelling of Football
Free Python course on football data covering event-data visualisation, expected goals models, passing networks, Expected Threat and Markov action values, pitch control, tracking-data positioning, physical metrics and player scouting with StatsBomb, Wyscout and Metrica data. The most complete free soccer-analytics curriculum, with code, lectures and exercises on open data.