gt_stack_team | R Documentation |
gt
and color one with school colorsThe gt_merge_stack_team_color()
function takes an existing gt
table and merges
column 1 and column 2, stacking column 1's text on top of column 2's.
Top text is in all caps with black bold text, while the lower text is smaller
and colored by the team name in another column.
This is a slightly modified version of gtExtras::gt_merge_stack()
written by Tom Mock.
gt_merge_stack_team_color( gt_object, col1, col2, team_col, font_size_top = 14, font_size_bottom = 12, color = "black" )
gt_object |
An existing gt table object of class |
col1 |
The column to stack on top. Will be converted to all caps, with black and bold text. |
col2 |
The column to merge and place below. Will be smaller and the school color that corresponds to |
team_col |
The column of team names that match |
font_size_top |
the font size for the top text. |
font_size_bottom |
the font size for the bottom text. |
color |
The color for the top text. |
An object of class gt_tbl
.
library(gt) teams <- "https://github.com/sportsdataverse/cfbfastR-data/raw/main/team_info/rds/cfb_team_info_2020.rds" team_df <- readRDS(url(teams)) stacked_tab <- team_df %>% transmute(logo = school,school,mascot,conference,city,state) %>% head(8) %>% gt::gt() %>% gt_merge_stack_team_color(school,mascot,school) %>% cfbplotR::gt_fmt_cfb_logo(columns = c("logo","conference"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.