gt - a (G)rammar of (T)ables

NFL tidyverse tables

Not to be confused with a Game of Thrones

Thomas Mock https://twitter.com/thomas_mock
05-18-2020
Preview of the table to come

gt package - a (g)rammar of (t)ables

gt is an R package for generating formatted tables from dataframes in R with a Grammar of Tables.

If you want to go deeper than this basic guide, check out the gt site, which has lots of examples!

Raw data comes from: Pro Football Reference & Over the Cap

Component parts of a gt table

Per the package website, gt has the following component parts:

The parts (roughly from top to bottom) are:

As you can see it is fleshing out the idea of formatting or adding various parts of the table in a robust way.


Read in the Data

I’ve gone through collecting the data and have put into a non-tidy wide format for Salary Rank, playoff week and appearances, Total appearances, and finally salary from 2014-2019.

library(gt) # for static tables
library(tidyverse) # all the things
library(paletteer) # for all the palettes

playoff_salary <- read_csv("https://raw.githubusercontent.com/jthomasmock/radix_themockup/master/_posts/2020-05-13-qb-salaries-vs-playoff-appearances/playoff_salary.csv")

glimpse(