
Replace 'reactable' Column Headers with Team Logos
Source:R/reactable_sdv.R
reactable_sdv_cols_label.RdBuilds a named list of reactable::colDef() objects whose
headers are team logos, for data frames whose column names are team
abbreviations. Columns that cannot be resolved are left out of the list so
reactable falls back to the plain column name.
Usage
reactable_sdv_cols_label(
.data,
...,
league,
variant = "default",
height = 30,
season = NULL,
id_system = "auto",
strict = FALSE
)Arguments
- .data
A data frame whose column names are team abbreviations.
- ...
Additional arguments passed to every
reactable::colDef().- league
A league key from
sdv_leagues().- variant
Character.
"default","dark", or a named variant fromsdv_marks()("scoreboard","grayscale", ...); seesdv_logo_url(). A team without it gets its closest mark, and in the browser the image falls back to the default mark when the variant's file fails to load.- height
Numeric. Image height in pixels.
- season
NULLfor today's mark, or a season (or one per team): the mark the team wore that season where the archive dates its marks.- id_system
"auto"(try every id system in priority order) or one id system:"team_id","espn","espn_abbr","nhl","nflverse","mlbstats","nba_api","hockeytech","ncaa","pff","cricinfo","cfbd","bref","sportsipy","fangraphs","yahoo","kenpom","torvik","sdvplotr","name", or one"auto"never tries because its numbers overlap ESPN's:"nhl_id"(NHL stats API ids),"fox","cbs","sports247"(247Sports team and institution ids) or"on3".- strict
If
TRUE, a value that does not resolve is an error; otherwise it becomesNAwith one warning per call.
Value
A named list of colDef objects for the columns argument of
reactable::reactable().