The gt_fmt_cfb_logo and gt_fmt_cfb_headshot functions take an existing gt_tbl object and converts college football team names from valid_team_names() into inline team logos or ESPN player ID's (or headshot_url from cfbfastR::cfbd_team_rosters() function) into inline player headshots. This is a wrapper around gtExtras::gt_image_rows() written by Tom Mock, which is a wrapper around gt::text_transform() + gt::web_image()/ gt::local_image() with the necessary boilerplate already applied.

gt_fmt_cfb_logo(gt_object, columns, height = 30)

gt_fmt_cfb_wordmark(gt_object, columns, height = 30)

gt_fmt_cfb_headshot(gt_object, columns, height = 30)

Arguments

gt_object

An existing gt table object of class gt_tbl

columns

The columns wherein changes to cell data colors should occur.

height

The absolute height (px) of the image in the table cell.

Value

An object of class gt_tbl.

Figures

Examples

library(gt)
#> Warning: package ‘gt’ was built under R version 4.1.2
library(cfbplotR)

df <- data.frame(team = valid_team_names()[1:8],
                 logo = valid_team_names()[1:8],
                 wordmark = valid_team_names()[1:8])

table <- df %>%
 gt() %>%
 gt_fmt_cfb_logo(columns = "logo") %>%
 gt_fmt_cfb_wordmark(columns = "wordmark")

df <- data.frame(
 player = c("Britain Covey", "Cameron Rising","Non.Match"),
 team = c("Utah","Utah","BYU")
) %>%
 cfbplotR::add_athlete_id_col(player)
#>  No season column, using 2021 rosters
table_2 <- df %>%
 gt() %>%
 gt_fmt_cfb_headshot(athlete_id)