Translate player IDs to player headshots and render these
images in html tables with the 'gt' package. IDs are ESPN athlete IDs by
default, or as id_system says. Only IDs that get no headshot URL
(missing, malformed, or absent from the id map id_system reads, such
as "gsis" or a provider's) are left as text. An ID that gets a URL
keeps it even when the CDN has no photo for it, so that cell can show a
broken image.
Usage
gt_sdv_headshots(
gt_object,
columns,
league,
height = 30,
locations = NULL,
id_system = "espn"
)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
locationsis notNULL.- 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 argumentcolumns. Otherwise, the cell or set of cells to be associated with the team name transformation. Onlygt::cells_body(),gt::cells_stub(),gt::cells_column_labels(), andgt::cells_row_groups()helper functions can be used here.- id_system
"espn"(ESPN athlete ids; the default, for every league with ESPN headshots),"gsis"(nflverse's NFL gsis ids, such as"00-0033873", read through a published map),"league"(the league's own player id), or another provider's player id, drawn as the ESPN athlete's headshot:"fox","yahoo","cbs","kenpom","ncaa"(stats.ncaa.org),"nba_stats"or"wnba_stats". The details ofsdv_headshot_url()list which leagues take which.



