Reprise exercises

We’ve not all been in the same room for a such a long time! Let’s make sure that the tidy toolkit is still at our fingertips.

Some nice NFL game by game player data (t0) and some salary data (t1)

library(tidyverse)
library(nflreadr)
library(magrittr)

t0 <- load_player_stats(
  seasons = T, 
  stat_type = "offense"
  )

t1 <- load_contracts()

1. Who achieved high yields in yards?

Among Quarterbacks and Running Backs, report the player who had the highest regular season passing or rushing (respectively), by season.

2. Who made gains and declines in touchdowns?

Again, among Quarterbacks and Running Backs and only during the regular season, summarize the total number of passing and rushing touchdowns (again respectively by position.) Consider the year to year change in these touchdowns–specifically, by position, report the player who had the largest total year to year increase in touchdowns. Then report the largest total decrease, again by position.

3. Who’s been well paid, by position and draft order?

Take the contract table t1 and summarize inflation adjusted salaries by draft position. Restrict the analysis to four offensive positions (Quarterbacks, Running Backs, Wide Receivers, and Left Tackles), and one defensive position (Edge Rushers). Report a table for every first round draft position (so, 1 through 32), where columns are the named positions, and cell entries are the highest paid player for that position and draft order pair.