[This article was first published on Fear and Loathing in Data Science, 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.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
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 advancednflstats.com. 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!< o:p>
> library(corrplot) #load the versatile package corrplot< o:p>
> attach(nfl)< o:p>
> head(nfl)< o:p>
Note: top 5 quarterbacks thru week 3:< o:p>
< !--[if !supportLists]--> 1. < !--[endif]-->Peyton Manning< o:p>
< !--[if !supportLists]--> 2. Jay Cutler
< o:p>
< !--[if !supportLists]--> 3. Ryan Tannehill
< o:p>
< !--[if !supportLists]--> 4. < !--[endif]-->Drew Brees< o:p>
< !--[if !supportLists]--> 5. < !--[endif]-->Philip Rivers< o:p>
> qb = cor(nfl[ ,4:15]) # correlation subset of continuous variables < o:p>
The package corrplot has 7 different visualization methods:
"circle"
, "square"
, "ellipse"
, "number"
, "shade"
, "color"
, "pie"
> corrplot(qb, method = “circle”)< o:p>
> corrplot(qb, method = “ellipse”)< o:p>
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.< o:p>
> corrplot.mixed(qb)< o:p>
If you are interested in further pursuing corrplot, I recommend this website.< o:p>
To leave a comment for the author, please follow the link and comment on their blog: Fear and Loathing in Data Science.
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.