gt_mlb_column_labels | R Documentation |
gt_mlb_column_labels
takes in a value of a team abbreviation or player id and
converts the designated column to the corresponding image.
gt_mlb_column_labels(
value,
type = c("mlb_logo", "scoreboard_logo", "dot_logo", "headshot", "dot_headshot"),
height = 30,
na_headshot_to_logo = TRUE
)
value |
What team abbreviation/player id should be replaced with an image? |
type |
What type of image is replacing the value? |
height |
The absolute height (px) of the image |
na_headshot_to_logo |
should NA/non player id matches return the MLB logo instead
of a grayed out blank headshot? Ignored unless |
HTML tag for image
library(gt)
library(mlbplotR)
df <- data.frame(BAL = 1,
TEX = 1,
LAD = 1,
"Mike_Trout" = 1,
"Shohei_Ohtani" = 1
)
gt_column_example <- df %>%
gt::gt() %>%
gt::cols_label(BAL = gt_mlb_column_labels("BAL", "mlb_logo"),
TEX = gt_mlb_column_labels("TEX", "scoreboard_logo"),
LAD = gt_mlb_column_labels("LAD", "dot_logo"),
"Mike_Trout" = gt_mlb_column_labels(545361, "dot_headshot"),
"Shohei_Ohtani" = gt_mlb_column_labels(660271, "headshot"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.