mbb_schedule_crosswalk: *Get the MBB cross-source schedule crosswalk*

View source: R/mbb_crosswalk.R

mbb_schedule_crosswalkR Documentation

Get the MBB cross-source schedule crosswalk

Description

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_name types description
season integer Season year.
game_date Date ET game date.
home_espn_team_id integer ESPN home team id (NA for bart-only rows).
away_espn_team_id integer ESPN away team id (NA for bart-only rows).
espn_game_id character ESPN game id (NA for bart-only rows).
bart_muid character Torvik muid (NA for espn-only rows).
bart_team1 character Torvik team1 name (NA for espn-only rows).
bart_team2 character Torvik team2 name (NA for espn-only rows).
bart_winner character Torvik winner name (NA for espn-only rows).
kp_game_id character KenPom game id (NA unless kenpom enabled).
fox_game_id character Fox game id (NA placeholder).
yahoo_game_id character Yahoo game id (NA placeholder).
match_method character "both"/"espn_only"/"bart_only".
match_confidence numeric 1 for matched, NA for unmatched.

See Also

Other MBB Crosswalk Functions: load_nba_team_crosswalk(), mbb_player_crosswalk(), mbb_team_crosswalk()

Examples


  try(mbb_schedule_crosswalk(season = 2025))


hoopR documentation built on Aug. 25, 2026, 9:07 a.m.