gt_nfl_cols_label | R Documentation |
Translate NFL team abbreviations into logos and wordmarks or NFL player gsis IDs to player headshots and render these images in column labels of 'gt' tables.
gt_nfl_cols_label(
gt_object,
columns = gt::everything(),
...,
height = 30,
type = c("logo", "wordmark", "headshot")
)
gt_object |
A table object that is created using the |
columns |
The columns for which the image translation should be applied.
Argument has no effect if |
... |
Currently not in use |
height |
The absolute height (px) of the image in the table cell. |
type |
One of |
An object of class gt_tbl
.
The article that describes how nflplotR works with the 'gt' package https://nflplotr.nflverse.com/articles/gt.html
The logo and wordmark rendering functions gt_nfl_logos()
and
gt_nfl_wordmarks()
.
The player headshot rendering function gt_nfl_headshots()
.
library(gt)
label_df <- data.frame(
"00-0036355" = 1,
"00-0033873" = 2,
"LAC" = 11,
"KC" = 12,
check.names = FALSE
)
# create gt table and translate player IDs and team abbreviations
# into headshots, logos, and wordmarks
table <- gt::gt(label_df) %>%
nflplotR::gt_nfl_cols_label(
columns = gt::starts_with("00"),
type = "headshot"
) %>%
nflplotR::gt_nfl_cols_label("LAC", type = "wordmark") %>%
nflplotR::gt_nfl_cols_label("KC", type = "logo")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.