<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="https://www.r-bloggers.com/the-steep-slide-of-nfl-draft-salaries/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://jessepiburn.com/2017/02/the-steep-slide-of-nfl-draft-salaries/"> R – Jesse Piburn</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Some friends and I got into a conversation about rookies in the NFL and how much their salaries were. We eventually started guessing how much more the first overall pick makes compared to, Mr. Irrelevant, the last pick of the NFL draft. It’s a pretty steep drop from number 1 to number 256 (7 rounds of 32 teams, plus a maximum of 32 compensatory selections), but it turns out most of that slide happens in the first 2 rounds. Below is the chart I came up with. <a target="_blank" rel="nofollow" href="http://i.imgur.com/bQel3PZ.png">Here</a> is a higher res link</p>
<p><img sizes="(max-width: 640px) 100vw, 640px" data-image-description="" data-orig-file="https://i2.wp.com/jessepiburn.com/wp-content/uploads/2017/02/rookie-salaries.png?fit=5760%2C4320" data-orig-size="5760,4320" data-image-title="rookie salaries" class="wp-image-224" data-comments-opened="1" data-recalc-dims="1" data-attachment-id="224" data-permalink="http://jessepiburn.com/2017/02/the-steep-slide-of-nfl-draft-salaries/rookie-salaries/" data-medium-file="https://i2.wp.com/jessepiburn.com/wp-content/uploads/2017/02/rookie-salaries.png?fit=300%2C225" data-large-file="https://i2.wp.com/jessepiburn.com/wp-content/uploads/2017/02/rookie-salaries.png?fit=640%2C480" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" src="https://i2.wp.com/jessepiburn.com/wp-content/uploads/2017/02/rookie-salaries.png?resize=640%2C480"></p>
<p>Here is the R code to reproduce the chart above, including the function to download the data from <a target="_blank" rel="nofollow" href="http://www.spotrac.com/">spotrac</a>, which is a great site by the way.</p>
<pre>####################################################################
# Create nfl draft salary chart
# date: 2/16/2017
# author: Jesse Piburn
#
####################################################################

# gtable and grid used to add the source text at the bottom -----
library(ggplot2)
library(ggthemes)
library(gtable)
library(grid)
library(dplyr)

getDraftContracts &lt;- function(year) {
  
  x &lt;- rvest::html(paste0(&quot;http://www.spotrac.com/nfl/draft/&quot;, year))
  x &lt;- rvest ::html_table(x)
  
  # each round is its own table -----
  x &lt;- lapply(1:length(x), FUN = function(i) {
    
    df &lt;- x[[i]]
    df$Round &lt;- i
    df$Cond_Pick &lt;- grepl(&quot; \\(C\\)&quot;, df$Pick)
    df$Pick &lt;- as.numeric(gsub(&quot; \\(C\\)&quot;, &quot;&quot;, df$Pick))
    df$Yrs &lt;- as.numeric(df$Yrs)
    
    df
    
  })
  
  df &lt;- dplyr::bind_rows(x)
  
  df$`Total Value` &lt;- as.numeric(gsub(&quot;\\$|,&quot;, &quot;&quot;, df$`Total Value`))
  
  df$`Signing Bonus` &lt;- as.numeric(gsub(&quot;\\$|,&quot;, &quot;&quot;, df$`Signing Bonus`))
  cap_index &lt;- which(names(df) == paste(year, &quot;Cap&quot;))
  df[, cap_index] &lt;- as.numeric(gsub(&quot;\\$|,&quot;, &quot;&quot;, df[, cap_index]))
  names(df)[cap_index] &lt;- &quot;Rookie Cap Hit&quot;
  df$`Yearly Avg` &lt;- df$`Total Value`/ df$Yrs
  df$Season &lt;- year
  
  df
}

yrs &lt;- 2011:2016

df_list &lt;- lapply(yrs, getDraftContracts)

df &lt;- dplyr::bind_rows(df_list)
df$Season &lt;- factor(df$Season)

plot_title &lt;- &quot;Average Annual Salary of Rookie Contract&quot;
plot_subtitle &lt;- &quot;Due to compensatory picks rounds 3 through 7 will have varying numbers of selections per season&quot;

p1 &lt;- ggplot(df, aes(x = Pick, y = `Yearly Avg`, colour = Season, group = Season)) + 
  geom_line(size = .8) + theme_fivethirtyeight() +
  ylab(&quot;Avg Yearly Value of Rookie Contract&quot;) +
  xlab(&quot;Pick&quot;) +
  scale_x_continuous(breaks = seq.default(1, 225, 32), 
                     labels =c(paste(&quot;Round&quot;, 1:3), 
                               paste(&quot;Pick&quot;, seq.default(1, 225, 32)[4:8]))) +
  scale_y_continuous(breaks = seq.default(1000000, 7000000, 1000000),
                     labels = paste0(&quot;$&quot;, 1:7, &quot; mil&quot;), expand = c(0,100000)) +
  labs(title = plot_title, 
       subtitle = plot_subtitle) +
  guides(colour = guide_legend(nrow = 1))

# outliers -----
label_df &lt;- df %>% filter(Player %in% c(&quot;Kyle Rudolph&quot;, &quot;Colin McCarthy&quot;, 
                                        &quot;Julius Thomas&quot;, &quot;Theo Riddick&quot;, 
                                        &quot;Braxton Miller&quot;))
label_df$label &lt;- paste0(label_df$Player,&quot; (&quot;, label_df$Pos, &quot;)&quot;)

p1 &lt;- p1 + geom_text(data = label_df, aes(x = Pick, y = `Yearly Avg`, colour = Season, label = label),
                     fontface = &quot;bold&quot;, show.legend = FALSE, nudge_x = c(-25, 15, -25, 20, -5), 
                     nudge_y = c(-60000, 120000, 0, 150000, 120000))

# turn into grob and add the bottom text -----
p1 &lt;- ggplotGrob(p1)

subtext &lt;- textGrob(&quot;Source: spotrac&quot;,
                    gp = gpar(fontsize = 12, fontface = &quot;italic&quot;,
                              fontfamily = &quot;sans&quot;, col = &quot;#696969&quot;),
                    just = &quot;left&quot;, x = unit(0.01, &quot;npc&quot;))

p1 &lt;- gtable_add_rows(p1, heights = unit(0, &quot;mm&quot;), pos = -1)
p1 &lt;- gtable_add_grob(p1, grobTree(subtext), t = nrow(p1), l = 1, 
                      b = nrow(p1)-1, r = 7)
grid.draw(p1)

ggsave(filename = &quot;plots/rookie salaries.png&quot;, plot = p1, width = 8*1.2, height = 6*1.2, dpi = 600, units = &quot;in&quot;)</pre>
<p> </p>
<p> </p>
<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://jessepiburn.com/2017/02/the-steep-slide-of-nfl-draft-salaries/"> R – Jesse Piburn</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="https://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="https://www.r-bloggers.com/search/data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="https://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="https://www.r-bloggers.com/search/map">maps</a>, <a title="Animation in R" rel="nofollow" href="https://www.r-bloggers.com/search/animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="https://www.r-bloggers.com/search/sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="https://www.r-bloggers.com/search/SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="https://www.r-bloggers.com/search/eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="https://www.r-bloggers.com/search/git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="https://www.r-bloggers.com/search/hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="https://www.r-bloggers.com/search/regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="https://www.r-bloggers.com/search/PCA">PCA</a>, <a title="Time series" rel="nofollow" href="https://www.r-bloggers.com/search/time+series">time series</a>, <a title="finance trading" rel="nofollow" href="https://www.r-bloggers.com/search/trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/JhYABjoGsyI"></a></div>