Skip to contents

Creates a factor of cleaned, valid team names. Levels are restricted to teams present in valid_team_names() so that downstream ggplot2 scales drop invalid entries gracefully.

Usage

sdv_team_factor(
  teams,
  sport = c("nfl", "nba", "wnba", "mlb", "nhl", "cfb", "mbb", "wbb")
)

Arguments

teams

Character vector of team names.

sport

Character string identifying the sport.

Value

An ordered factor of the cleaned, valid team names.

Examples

sdv_team_factor(c("KC", "BUF", "invalid"), sport = "nfl")
#> [1] KC   BUF  <NA>
#> Levels: BUF KC