Turns whatever team identifiers you have (abbreviations, full
names, ESPN, nflverse, MLB Stats, nba_api, HockeyTech, CFBD, Sports
Reference and other ids) into the index's canonical team_id, never
guessing. Every sdvplotR helper that takes a team resolves it this way.
The R counterpart of sdvplot's resolve(), and it gives the same answers.
Arguments
- x
A vector of team identifiers (character, numeric or factor).
- league
A league key from
sdv_leagues(). Required: one abbreviation means different teams in different leagues.- season
NULL, one season year, or one per value: picks the team that used a reused code that season. Without one, a reused code means its current holder. Split seasons take their ending year (2021 for 2020-21).- 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.
See also
sdv_suggest() for a value that did not resolve, sdv_teams(),
sdv_aliases() for the values each id system holds.
Examples
sdv_resolve(c("KC", "Kansas City Chiefs", "OAK"), "nfl")
#> [1] "12" "12" "13"
sdv_resolve("QUE", "nhl", season = 1990)
#> [1] "17"
sdv_resolve(c("Iowa St.", "Miami (OH)"), "mbb")
#> [1] "66" "193"
# a Fox id: "auto" never tries Fox, whose numbers overlap ESPN's
sdv_resolve("54", "mbb", id_system = "fox")
#> [1] "41"
# the international leagues take a name or the league's own team id
sdv_resolve(c("Real Madrid", "MAD"), "euroleague")
#> [1] "MAD" "MAD"
