March 7, 2013
By

[This article was first published on Fantasy Football Analytics » R | Fantasy Football Analytics, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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

### The R Script

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.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.