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,
  league,
  height = 30,
  locations = NULL,
  season = NULL,
  id_system = "auto",
  strict = FALSE
)

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.

league

A league key from sdv_leagues().

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.

season

NULL (the default) for today's marks, or one season whose marks every cell shows (the ending year for the NHL). See the Historical logos section.

id_system, strict

How the team values are read and what an unresolved one does, as in sdv_logo_url().

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", league = "nfl")
team wins
Kansas City Chiefs 14
Buffalo Bills 13
San Francisco 49ers 12
# }