gt_mlb_column_labels {mlbplotR} | R Documentation |
Replace Team Abbreviations/Player IDs With Images In Column Labels
Description
gt_column_example
takes in a value of a team abbreviation or player id and
converts the designated column to the corresponding image.
Usage
gt_mlb_column_labels(
value,
type = c("mlb_logo", "scoreboard_logo", "headshot"),
height = 30,
na_headshot_to_logo = TRUE
)
Arguments
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? Defaults to |
Value
HTML tag for image
Examples
library(gt)
library(mlbplotR)
df <- data.frame(BAL = 1,
TEX = 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"),
"Mike_Trout" = gt_mlb_column_labels(545361, "headshot"),
"Shohei_Ohtani" = gt_mlb_column_labels(660271, "headshot"))
[Package mlbplotR version 1.1.0 Index]