In this post, I show how to download fantasy football projections from the web using R. In prior posts, I showed how to scrape projections from ESPN, CBS, NFL.com, and FantasyPros. In this post, I compile the R scripts for scraping projections from these sites, in addition to the following sites: Accuscore, FantasySharks, FFtoday, FOX Sports, and Yahoo.
Why Scrape Projections?
Scraping projections from multiple sources on the web allows us to automate importing the projections with a simple script. Automation makes importing more efficient so we don’t have to manually download the projections whenever they’re updated. Once we import all of the projections, there’s a lot we can do with them, like:
- Determine who has the most accurate projections
- Calculate projections for your league
- Calculate players’ risk levels
- Calculate players’ value over replacement
- Identify sleepers
- Calculate the highest value you should bid on a player in an auction draft
- Draft the best starting lineup
- Win your auction draft
- Win your snake draft
The R Scripts
#Load libraries library("XML") #Download fantasy football projections from FantasyPros.com qb_fp <- readHTMLTable("http://www.fantasypros.com/nfl/projections/qb.php", stringsAsFactors = FALSE)$data rb_fp <- readHTMLTable("http://www.fantasypros.com/nfl/projections/rb.php", stringsAsFactors = FALSE)$data wr_fp <- readHTMLTable("http://www.fantasypros.com/nfl/projections/wr.php", stringsAsFactors = FALSE)$data te_fp <- readHTMLTable("http://www.fantasypros.com/nfl/projections/te.php", stringsAsFactors = FALSE)$data
The R Scripts for scraping the different sources are located below:
- CBS – Jamey Eisenberg
- CBS – Dave Richard
- CBS – Average
- FOX Sports
Below is a density plot of the projections from the different sources:
Scraping projections from the web is fast, easy, and automated with R. Once you’ve downloaded the projections, there’s so much you can do with the data to help you win your league! Let me know in the comments if there are other sources you want included (please provide a link).
The post Scraping Fantasy Football Projections from the Web appeared first on Fantasy Football Analytics.