gt_nfl_logos | R Documentation |
Translate NFL team abbreviations into logos and wordmarks and render these images in html tables with the 'gt' package.
gt_nfl_logos(gt_object, columns, height = 30, locations = NULL)
gt_nfl_wordmarks(gt_object, columns, height = 30, locations = NULL)
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 |
height |
The absolute height (px) of the image in the table cell. |
locations |
If |
An object of class gt_tbl
.
The player headshot rendering function gt_nfl_headshots()
.
The article that describes how nflplotR works with the 'gt' package https://nflplotr.nflverse.com/articles/gt.html
library(gt)
library(nflplotR)
teams <- valid_team_names()
# remove conference logos from this example
teams <- teams[!teams %in% c("AFC", "NFC", "NFL")]
# create dataframe with all 32 team names
df <- data.frame(
team_a = head(teams, 16),
logo_a = head(teams, 16),
wordmark_a = head(teams, 16),
team_b = tail(teams, 16),
logo_b = tail(teams, 16),
wordmark_b = tail(teams, 16)
)
# create gt table and translate team names to logo/wordmark images
table <- df %>%
gt() %>%
gt_nfl_logos(columns = gt::starts_with("logo")) %>%
gt_nfl_wordmarks(columns = gt::starts_with("wordmark"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.