NFL week 3 update

September 25, 2013

(This article was first published on Fear and Loathing in Data Science, and kindly contributed to R-bloggers)

With another NFL week down we are starting to see separation from the contenders and the “better luck next year” teams.  Any paid TV mouthpiece worth their salt will tell you it is a quarterback driven league.  Driven indeed.  In the last post, I dabbled in the simple code of a correlation heat map.  Now, I realize I may have led the flock astray in my haste to create some wow graphics using the data from  But that is the great thing about R, the ability to cook up some code and add salt to taste.  So, let’s kick it up a notch with a look at the week 3 NFL QB data, creating different versions of correlation plots.  Choose your preference, a la carte!
> library(corrplot) #load the versatile package corrplot
> attach(nfl)
> head(nfl)
Note: top 5 quarterbacks thru week 3:
      1.      Peyton Manning
      2.      Jay Cutler
      3.      Ryan Tannehill
      4.      Drew Brees
      5.      Philip Rivers
> qb = cor(nfl[ ,4:15]) # correlation subset of continuous variables
The package corrplot has 7 different visualization methods: "circle", "square", "ellipse", "number", "shade", "color", "pie"

> corrplot(qb, method = “circle”)

> corrplot(qb, method = “ellipse”)

Two nice examples, but this is my favorite below.  I really like the ability to see both the visual portrayal and the statistics on one chart.

> corrplot.mixed(qb)

If you are interested in further pursuing corrplot, I recommend this website.

To leave a comment for the author, please follow the link and comment on their blog: Fear and Loathing in Data Science. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, 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.


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)