Skip to contents

Translate team abbreviations into wordmarks and render these images in html tables with the 'gt' package.

Usage

gt_sdv_wordmarks(
  gt_object,
  columns,
  sport = c("nfl", "nba", "wnba", "mlb", "nhl", "cfb", "mbb", "wbb"),
  height = 30,
  locations = NULL
)

Arguments

gt_object

A table object created using gt::gt().

columns

The columns for which the image translation should be applied. Argument has no effect if locations is not NULL.

sport

Character string identifying the sport.

height

The absolute height (px) of the image in the table cell.

locations

If NULL (the default), the function will render logos in argument columns. Otherwise, the cell or set of cells to be associated with the team name transformation. Only gt::cells_body(), gt::cells_stub(), gt::cells_column_labels(), and gt::cells_row_groups() helper functions can be used here.

Value

An object of class gt_tbl.

Examples

# \donttest{
library(gt)
df <- data.frame(team = c("KC", "BUF", "SF"), wins = c(14, 13, 12))
df |>
  gt() |>
  gt_sdv_wordmarks(columns = "team", sport = "nfl")
team wins
The KC logo 14
The BUF logo 13
The SF logo 12
# }