Translate team abbreviations into logos and render these images in column labels of 'gt' tables.
Usage
gt_sdv_cols_label(
gt_object,
columns = gt::everything(),
sport = c("nfl", "nba", "wnba", "mlb", "nhl", "cfb", "mbb", "wbb"),
height = 30,
type = c("logo", "wordmark", "headshot"),
id_type = NULL
)Arguments
- gt_object
A table object created using
gt::gt().- columns
The columns whose labels should be replaced with logos.
- sport
Character string identifying the sport.
- height
The absolute height (px) of the image.
- type
One of
"logo","wordmark"or"headshot": whether the column names are team abbreviations (logo / wordmark) or player IDs (headshot).- id_type
Which ID system
player_idholds.NULL(the default) takes GSIS IDs for the NFL and ESPN athlete IDs for every other sport."espn"takes ESPN athlete IDs for any sport, the IDs in ESPN-sourced data such as hoopR's and wehoop'sespn_*()functions."league"takes the league's own ID: the GSIS ID for the NFL, the NBA Stats or WNBA StatsPERSON_ID(hoopR'snba_*(), wehoop'swnba_*()), the MLBAM ID (baseballr'smlb_*(), Baseball Savant) for MLB, or the NHL API player ID (fastRhockey'snhl_*()andload_nhl_*()) for the NHL, drawn from that league's image CDN; college sports have no league option. ESPN and league IDs other than GSIS are plain digits, so a mismatch draws the wrong player or no image rather than an error. League CDNs draw a silhouette for an unknown ID, and the NBA and WNBA CDNs refuse requests from datacenter IPs, so a plot drawn on CI or a server can come back without those headshots.



