Skip to contents

Builds 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,
  ...,
  sport = c("nfl", "nba", "wnba", "mlb", "nhl", "cfb", "mbb", "wbb"),
  variant = c("primary", "dark", "light", "alt", "classic", "helmet"),
  height = 30
)

Arguments

.data

A data frame whose column names are team abbreviations.

...

Additional arguments passed to every reactable::colDef().

sport

Character string identifying the sport. One of supported_sports().

variant

Character. Logo variant: "primary", "dark", "light", "alt", "classic", or "helmet" (NFL only). Falls back to the primary image when the requested variant is not available for a team.

height

Numeric. Image height in pixels.

Value

A named list of colDef objects for the columns argument of reactable::reactable().

Examples

library(reactable)
library(sdvplotR)

df <- data.frame(KC = 1:3, BUF = 4:6, SF = 7:9)
reactable(df, columns = reactable_sdv_cols_label(df, sport = "nfl"))