gt_mlb_headshots | R Documentation |
gt_fmt_mlb_headshot
, gt_fmt_mlb_dot_headshot
, and gt_fmt_milb_dot_headshot
take an existing gt_tbl
object and converts player ids into 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_mlb_headshot(
gt_object,
columns,
height = 30,
na_headshot_to_logo = TRUE,
locations = NULL
)
gt_fmt_mlb_dot_headshot(
gt_object,
columns,
height = 30,
na_headshot_to_logo = TRUE,
locations = NULL
)
gt_fmt_milb_dot_headshot(
gt_object,
columns,
height = 30,
na_headshot_to_logo = TRUE,
locations = NULL
)
gt_object |
An existing gt table object of class |
columns |
The columns wherein changes to cell data colors should occur.
Has no effect if |
height |
The absolute height (px) of the image in the table cell |
na_headshot_to_logo |
should NA/non matches return the MLB logo instead
of a grayed out blank headshot? Only has an effect with |
locations |
If |
An object of class gt_tbl
.
library(gt)
library(mlbplotR)
gt_headshot_example <- mlbplotR::load_headshots() %>%
head(5) %>%
dplyr::select(player_name, savant_id1 = savant_id, savant_id2 = savant_id) %>%
gt::gt() %>%
gt_fmt_mlb_headshot(columns = "savant_id1") %>%
gt_fmt_mlb_dot_headshot(columns = "savant_id2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.