Created
January 6, 2021 18:18
-
-
Save tejseth/fad3f91601e0a9905168863950b90db2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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