gt_mlb | R Documentation |
gt
tableThe gt_fmt_mlb_logo
, gt_fmt_mlb_scoreboard_logo
, and gt_fmt_mlb_dot_logo
functions take an existing
gt_tbl
object and converts MLB team names from valid_team_names()
into team logos.
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_logo(gt_object, columns, height = 30, locations = NULL)
gt_fmt_mlb_scoreboard_logo(gt_object, columns, height = 30, locations = NULL)
gt_fmt_mlb_dot_logo(gt_object, columns, height = 30, locations = NULL)
gt_object |
An existing gt table object of class |
columns |
The columns wherein changes to cell data colors should occur.
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
.
library(gt)
library(mlbplotR)
df <- data.frame(team = valid_team_names()[1:5],
logo = valid_team_names()[1:5],
scoreboard_logo = valid_team_names()[1:5],
dot_logo = valid_team_names()[1:5])
gt_logo_example <- df %>%
gt::gt() %>%
gt_fmt_mlb_logo(columns = "logo") %>%
gt_fmt_mlb_scoreboard_logo(columns = "scoreboard_logo") %>%
gt_fmt_mlb_dot_logo(columns = "dot_logo")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.