gtand color one with school colors
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" )
An existing gt table object of class
The column to stack on top. Will be converted to all caps, with black and bold text.
The column to merge and place below. Will be smaller and the school color that corresponds to
The column of team names that match
valid_team_names() for the color of the bottom.
the font size for the top text.
the font size for the bottom text.
The color for the top text.
An object of class
library(gt) teams <- "https://github.com/sportsdataverse/cfbfastR-data/raw/master/team_info/rds/cfb_team_info_2020.rds" team_df <- readRDS(url(teams)) #> Warning: cannot open URL 'https://github.com/sportsdataverse/cfbfastR-data/raw/master/team_info/rds/cfb_team_info_2020.rds': HTTP status was '404 Not Found' #> Error in readRDS(url(teams)): cannot open the connection to 'https://github.com/sportsdataverse/cfbfastR-data/raw/master/team_info/rds/cfb_team_info_2020.rds' 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")) #> Error in transmute(., logo = school, school, mascot, conference, city, state): object 'team_df' not found