Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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