Downloading CBS Fantasy Football Projections in R

March 7, 2013
By

(This article was first published on Fantasy Football Analytics » R | Fantasy Football Analytics, and kindly contributed to R-bloggers)

In this post, I will show how to download CBS fantasy football projections using R.

The R Script

The R Script for downloading fantasy football projections from CBS is located at: https://github.com/dadrivr/FantasyFootballAnalyticsR/blob/master/R%20Scripts/CBS%20Projections.R
 
Here are lines of code to download the CBS projections from CBSsports.com:
#Download fantasy football projections from cbssports.com
qb_cbs ("http://fantasynews.cbssports.com/fantasyfootball/stats/weeklyprojections/QB/season", stringsAsFactors = FALSE)[7]$'NULL'
rb1_cbs ("http://fantasynews.cbssports.com/fantasyfootball/stats/weeklyprojections/RB/season", stringsAsFactors = FALSE)[7]$'NULL'
rb2_cbs ("http://fantasynews.cbssports.com/fantasyfootball/stats/weeklyprojections/RB/season?&start_row=51", stringsAsFactors = FALSE)[7]$'NULL'
wr1_cbs ("http://fantasynews.cbssports.com/fantasyfootball/stats/weeklyprojections/WR/season", stringsAsFactors = FALSE)[7]$'NULL'
wr2_cbs ("http://fantasynews.cbssports.com/fantasyfootball/stats/weeklyprojections/WR/season?&start_row=51", stringsAsFactors = FALSE)[7]$'NULL'
te_cbs ("http://fantasynews.cbssports.com/fantasyfootball/stats/weeklyprojections/TE/season", stringsAsFactors = FALSE)[7]$'NULL'
Here’s a density plot of the CBS projections:
ggplot(projections_cbs, aes(x=pts_cbs)) + geom_density(fill="red", alpha=.3) + xlab("Player's Projected Points") + ggtitle("Density Plot of CBS Projected Points from 2012")

In my next post, I will show how to download NFL.com fantasy football projections using R.

The post Downloading CBS Fantasy Football Projections in R appeared first on Fantasy Football Analytics.

To leave a comment for the author, please follow the link and comment on his blog: Fantasy Football Analytics » R | Fantasy Football Analytics.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.