Coding for Sports Analytics: Resources to Get Started

These days, if you want to work in sports analytics, you need to know how to code. There’s really no way around it. And while that can be scary for someone who’s never written a line of code before, it’s not as daunting as it seems.

The reality is that there are a variety of excellent (often free!) resources for learning how to code. Some of them are very general, some are focused on a specific programming language, and some are focused on a specific use case, like sports analytics.

Below is a list of fantastic resources for learning how to code specifically for sports analytics. Because sports analytics is typically done in either R or Python, most of what you’ll find below is focused on those two languages, however, many of the methods used in R and Python can be applied to other languages and use cases beyond sports.

This list is based on (read: “essentially copied directly from”) a thread I posted on the Measurables Twitter account earlier this year. I’m duplicating it here simply because some people might find a blog post easier to navigate than a Twitter thread. I’ll be keeping this list updated with any new resources I discover.

If you’re unsure where to start, reach out! You can find my contact info here.

๐Ÿˆ Ben Baldwin’s guide to using nflscrapR, an R package for NFL data analysis

๐Ÿˆ Thomas Mock’s guide to improving your nflscrapR graphics

๐Ÿˆ Nathan Braun’s eBook “Learn to Code with Fantasy Football”

๐Ÿˆ Parker Fleming’s Introduction to College Football Data with R and cfbscrapR

๐Ÿˆ Garret McClintock’s Introduction to College Football Data Using Python

๐Ÿˆ Michael Lopez’s “R for NFL analysis”

โšพ Daniel Poston’s Scikit-Learn (a Python package) tutorial with baseball data

โšพ Brice Russ’s “How To Use R For Sports Stats, Part 1: The Absolute Basics” on FanGraphs

โšฝ FC Python, a site that teaches Python through soccer data

โšฝ FC RStats, a site that teaches R through soccer data

โšฝ Devin Pleuler’s Soccer Analytics Handbook

โšฝ Tom Whelan’s “Python for Fantasy Football”

๐Ÿ’ Evan Oppenheimer’s “R for Hockey Analysis โ€” Part 1: Installation and First Steps” on Toward Data Science

๐Ÿ’ Meghan Hall’s “An Introduction to R With Hockey Data” on Hockey-Graphs

๐Ÿ€ Ryan Davis’s tutorials for processing NBA data in Python

๐Ÿ€ Robert Clark’s “Python Sports Analytics Made Simple”

๐Ÿ‘ Chris Fry’s tutorial on graphing in R using field hockey data

Updated 9/24/20 with new resources