How to create NBA shot charts in R

A while ago I found this fantastic post about NBA shot charts built in Python. Since my Python skills are quite basic I decided to reproduce such charts in R using data scraped from the internet and ggplot2.

Getting the Data

First we need the shot data from stats.nba.com. This blog post from Greg Reda does a great job explaining how to find the underlying API and extract data from a web app (in this case, stats.nba.com).

To get shot data for Stephen Curry we will use this url. The url shows the shots taken by Curry during the 2014-15 regular season in a JSON structure. Note also that Season, SeasonType and PlayerID are parameters in the url. Stephen Curry’s PlayerID is 201939.

Continue reading

Advertisements

Principal Component Analysis and surfers performance

I had access to surfing data from surf-stats.com, a site that collects data for fantasy surfing.  It contains average scores for 55 surfers in the 2014 World Surfing League under different conditions: wind, wave size, surf break, weather and more. Scores are continuous, varying from 0 to 20.

This is how the WSL scoring works in more detail: Continue reading

Who is the next Rugby League player to follow Jarryd Hayne to the NFL according to the data?

Former Australian Rugby League player Jarryd Hayne has become the story of the NFL pre season playing for the San Francisco 49ers. After 2 games, Hayne is second in the league in rushing yards (117) and leads the 49ers in average yards per punt return (21.6).

Are there other Rugby League players capable of causing the same impact in the NFL? If so, who are they? Who should NFL recruiters keep an eye on? Continue reading