Skip to content

Instantly share code, notes, and snippets.

@tejseth
Created January 6, 2021 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tejseth/fad3f91601e0a9905168863950b90db2 to your computer and use it in GitHub Desktop.
Save tejseth/fad3f91601e0a9905168863950b90db2 to your computer and use it in GitHub Desktop.
cov_stats <- cov_stats %>%
mutate(freq = plays / 14575)
#Creating a table
cov_table <- cov_stats %>%
gt() %>%
tab_header(
title = "2018 Coverage Statistics",
subtitle = "Coverages were assigned based on random forest classification"
) %>%
cols_label(most_freq_cov = "Coverage", plays = "Number of Plays", def_epa = "EPA/Play Allowed", freq = "Frequency") %>%
data_color(
columns = vars(def_epa),
colors = scales::col_numeric(
palette = c(
"green", "yellow", "red"),
domain = c(0.1,0.8))) %>%
data_color(
columns = vars(plays),
colors = scales::col_numeric(
palette = c(
"cadetblue1", "cadetblue2", "cadetblue3"),
domain = c(40,8000))) %>%
cols_align(
align = "center") %>%
tab_source_note(md("By Tej Seth | @mfbanalytics | Data from the Big Data Bowl"))
cov_table
gtsave(cov_table, "cov_table.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment