Skip to contents

Build a wide, one-row-per-game crosswalk linking ESPN and Bart Torvik (barttorvik.com) game identifiers for an MBB season. Fox Sports and Yahoo game IDs are NA placeholders. KenPom game IDs are optionally enriched when include_kenpom = TRUE and credentials are set (see below). Dates are reduced to Eastern-Time game dates before joining; Torvik team1/team2 are unordered (the join uses a sorted team-pair key, so home/away from the Torvik side is not preserved). Games where either Torvik team name cannot be resolved to an ESPN id via mbb_team_crosswalk() are kept as bart_only rows.

KenPom (optional): KenPom requires a paid subscription. Set the environment variables KP_USER (email) and KP_PW (password) and pass include_kenpom = TRUE. When include_kenpom = FALSE (the default) or when credentials are absent, kp_game_id is left as NA and no network calls to KenPom are made. Errors from individual team schedule calls are silently dropped so the function always returns a complete crosswalk even when partial KenPom data is unavailable.

Usage

mbb_schedule_crosswalk(
  season = most_recent_mbb_season(),
  include_kenpom = FALSE
)

Arguments

season

Season year (4-digit, e.g. 2025). Defaults to most_recent_mbb_season().

include_kenpom

Logical. When TRUE AND KP_USER is set, attempts to enrich kp_game_id via per-team kp_team_schedule() calls. Default FALSE.

Value

A hoopR_data tibble, one row per game:

col_nametypesdescription
seasonintegerSeason year.
game_dateDateET game date.
home_espn_team_idintegerESPN home team id (NA for bart-only rows).
away_espn_team_idintegerESPN away team id (NA for bart-only rows).
espn_game_idcharacterESPN game id (NA for bart-only rows).
bart_muidcharacterTorvik muid (NA for espn-only rows).
bart_team1characterTorvik team1 name (NA for espn-only rows).
bart_team2characterTorvik team2 name (NA for espn-only rows).
bart_winnercharacterTorvik winner name (NA for espn-only rows).
kp_game_idcharacterKenPom game id (NA unless kenpom enabled).
fox_game_idcharacterFox game id (NA placeholder).
yahoo_game_idcharacterYahoo game id (NA placeholder).
match_methodcharacter"both"/"espn_only"/"bart_only".
match_confidencenumeric1 for matched, NA for unmatched.

Examples

# \donttest{
  try(mbb_schedule_crosswalk(season = 2025))
#>  2026-06-13 07:27:22.929263: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:23.899596: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:24.232558: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:24.294627: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:24.516986: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:24.841664: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:25.04556: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:25.111888: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:25.417708: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:25.721275: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:25.78496: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:25.957034: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:26.127483: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:26.335637: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:26.639249: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:26.893692: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:27.202074: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:27.64256: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:27.706099: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:27.766868: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:28.195258: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:28.333735: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:28.772354: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:28.835008: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:29.023213: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:29.235686: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:29.405321: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:29.468367: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:29.636759: no Fox CBK teams data available!
#>  Error: The API returned an error
#>  2026-06-13 07:27:29.690725: Invalid arguments or no schedule available for 2025!
#>  Args: year = 2025
#>  Error: lexical error: invalid char in json text.                                        <!DOCTYPE HTML PUBLIC "-//W3C//                      (right here) ------^ 
#> ── MBB schedule crosswalk (ESPN / Torvik) ─────────────────────── hoopR 3.1.0 ──
#>  Data updated: 2026-06-13 07:27:29 UTC
#> # A tibble: 0 × 14
#> # ℹ 14 variables: season <int>, game_date <date>, home_espn_team_id <int>,
#> #   away_espn_team_id <int>, espn_game_id <chr>, bart_muid <chr>,
#> #   bart_team1 <chr>, bart_team2 <chr>, bart_winner <chr>, kp_game_id <chr>,
#> #   fox_game_id <chr>, yahoo_game_id <chr>, match_method <chr>,
#> #   match_confidence <dbl>
# }