Plot the Scoring Streak of an NHL Player with R

I am a big Boston Bruins fan and have enjoyed the ups and downs over the last few years, regardless of the catastrophes that have occurred during the playoffs.  The team struggled a few weeks ago, but have recently seemed to find their stride.

During that time frame, in my opinion Nathan Horton was a significant factor in those wins. For a long chunk of the season though, it felt like he was in a rut.   It got me thinking about how we could actually use some data to see how “streaky” a player is.  In this case, Nathan Horton.

The code below uses R to collect what we need from the web and plot the cumulative goals over the course of a season. Each dot on the line should represent a game, so it is easy to view games played versus production across each season of a career.

A big thank you to @Bernd on  stackoverflow for his help and Hadley for making some great R packages.  Also, I am starting to warm up to R Studio and think its a great tool for those coming from software like SAS or SPSS..

Resulting plot:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>