gt_cfb | R Documentation |
gt
tableThe 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)
gt_object |
An existing gt table object of class |
columns |
The columns wherein changes to cell data colors should occur. |
height |
The absolute height (px) of the image in the table cell. |
An object of class gt_tbl
.
library(gt) 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) table_2 <- df %>% gt() %>% gt_fmt_cfb_headshot(athlete_id)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.