gt_milb | R Documentation |
gt
tableThe gt_fmt_milb_logo
and gt_fmt_milb_dot_logo
functions take an existing
gt_tbl
object and converts MiLB 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_milb_logo(gt_object, columns, height = 30, locations = NULL)
gt_fmt_milb_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)
gt_milb_example <- mlbplotR::load_milb_teams() %>%
dplyr::filter(parent_org_name == "Texas Rangers") %>%
dplyr::mutate(dot = team_name) %>%
dplyr::select(team_name, dot, team_location, team_mascot) %>%
gt::gt() %>%
gt_fmt_milb_logo(columns = "team_name") %>%
gt_fmt_milb_dot_logo(columns = "dot")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.