Skip to contents

helper that loads multiple seasons from the data repo either into memory or writes it into a db using some forwarded arguments in the dots

helper that loads multiple seasons from the data repo either into memory or writes it into a db using some forwarded arguments in the dots

helper that loads multiple seasons from the data repo either into memory or writes it into a db using some forwarded arguments in the dots

helper that loads multiple seasons from the data repo either into memory or writes it into a db using some forwarded arguments in the dots

helper that loads multiple seasons of ESPN men's college basketball team rosters from the sportsdataverse-data release repo, either into memory or into a database via forwarded arguments in the dots.

helper that loads multiple seasons of ESPN men's college basketball player season stats (long format) from the sportsdataverse-data release repo, either into memory or into a database via forwarded arguments in the dots.

helper that loads multiple seasons of ESPN men's college basketball team season stats (long format) from the sportsdataverse-data release repo, either into memory or into a database via forwarded arguments in the dots.

helper that loads multiple seasons of ESPN men's college basketball standings from the sportsdataverse-data release repo, either into memory or into a database via forwarded arguments in the dots.

helper that loads multiple seasons of ESPN men's college basketball per-game rosters from the sportsdataverse-data release repo, either into memory or into a database via forwarded arguments in the dots.

helper that loads multiple seasons of ESPN men's college basketball per-game officials from the sportsdataverse-data release repo, either into memory or into a database via forwarded arguments in the dots.

helper that loads multiple seasons of ESPN MBB athlete core records – identity and biographical fields, one row per athlete who appeared in the season – from the sportsdataverse-data release repo, either into memory or into a database via forwarded arguments in the dots.

This is the only source of athlete bio in the pipeline: the player season stats payload carries no identity at all – not even the athlete id.

Two properties of the source are worth knowing before joining:

  • current_team_id is the athlete's CURRENT team, not their team in the requested season. Season team lives in load_mbb_player_box() / load_mbb_player_stats().

  • Bio (height / weight / jersey) is a current snapshot that ESPN overwrites in place; it is not era-correct for a historical season. The season dimension here is participation, not the bio's vintage.

Field coverage is era-dependent by nature – headshots exist only for modern players, while college and date of birth thin out the other way.

Loads shot events parsed from ESPN men's college basketball play-by-play feeds. One row per shot attempt (made or missed), with court coordinates and shot metadata. Backed by the hoopR-mbb-data pipeline, publishing parquet/rds artifacts to the espn_mens_college_basketball_shots release tag. Published coverage runs 2003 and 2006 through the most recent season – 2004 and 2005 are a documented gap (no shot-coordinate assets were published for those two seasons).

Usage

load_mbb_pbp(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_team_box(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_player_box(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_schedule(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_rosters(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_player_stats(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_team_stats(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_standings(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_game_rosters(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_officials(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_player_core(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_mbb_shots(
  seasons = most_recent_mbb_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

Arguments

seasons

A vector of 4-digit years associated with given men's college basketball seasons. (Min: 2006)

...

Additional arguments passed to an underlying function that writes the season data into a database (used by update_mbb_db()).

dbConnection

A DBIConnection object, as returned by

tablename

The name of the play by play data table within the database

Value

Returns a tibble

col_nametypesdescription
idnumericId.
sequence_numbercharacterSequence number representing a shot-possession (V3 PBP).
type_idcharacterType identifier (numeric).
type_textcharacterDisplay text for the type field.
textcharacterText description of the play / record.
away_scoreintegerAway team score after the play. Rebuilt from the scoring plays in feed order when that reaches the official final (score_source 'rebuilt'), otherwise ESPN's per-play value (score_source 'espn').
home_scoreintegerHome team score after the play. Rebuilt from the scoring plays in feed order when that reaches the official final (score_source 'rebuilt'), otherwise ESPN's per-play value (score_source 'espn').
period_numberintegerNumeric period (1-4 for quarters; 5+ for OT).
period_display_valuecharacterPeriod display label (e.g. '1st Quarter', 'OT').
clock_display_valuecharacterGame clock display string (e.g. '8:32').
scoring_playlogicalTRUE if the play resulted in points scored.
score_valueintegerPoint value of the play (2 / 3 / 1).
team_idcharacterUnique team identifier.
participants_0_athlete_idcharacterV2 PBP participant 0 (primary) athlete ID.
wallclockcharacterWallclock.
shooting_playlogicalTRUE if the play was a shooting attempt.
participants_1_athlete_idcharacterV2 PBP participant 1 (secondary) athlete ID.
seasonintegerSeason identifier (4-digit year or 'YYYY-YY' string).
season_typeintegerSeason type (1=pre-season, 2=regular season, 3=postseason, 4=off-season for ESPN; or string label for WNBA Stats).
away_team_idintegerUnique identifier for the away team.
away_team_namecharacterAway team name.
away_team_mascotcharacterAway team mascot.
away_team_abbrevcharacterAway team three-letter abbreviation.
away_team_name_altcharacterAlternate away team name.
home_team_idintegerUnique identifier for the home team.
home_team_namecharacterHome team name.
home_team_mascotcharacterHome team mascot.
home_team_abbrevcharacterHome team three-letter abbreviation.
home_team_name_altcharacterAlternate home team name.
home_team_spreadnumericHome team's point spread.
game_spreadnumericGame spread (signed; positive = home favored).
home_favoritelogicalTRUE if the home team is the betting favorite.
game_spread_availablelogicalTRUE if a point spread was available.
game_idintegerUnique game identifier.
qtrintegerQuarter (1-4) or OT period (5+).
timecharacterTime / clock value.
clock_minutescharacterClock minutes split out for convenience.
clock_secondscharacterClock seconds split out for convenience.
halfcharacterHalf of the game (1 or 2).
game_halfcharacterHalf of the game (1 or 2).
lag_qtrnumericQuarter lag (the previous-play's quarter).
lead_qtrnumericQuarter lead (the next-play's quarter).
lag_game_halfcharacterHalf lag (the previous-play's half).
lead_game_halfcharacterHalf lead (the next-play's half).
start_quarter_seconds_remainingintegerSeconds remaining in the period at the start of the play.
start_half_seconds_remainingintegerSeconds remaining in the half at the start of the play.
start_game_seconds_remainingintegerSeconds remaining in the game at the start of the play.
game_play_numberintegerSequential play number within the game.
end_quarter_seconds_remainingnumericSeconds remaining in the period at the end of the play.
end_half_seconds_remainingnumericSeconds remaining in the half at the end of the play.
end_game_seconds_remainingnumericSeconds remaining in the game at the end of the play.
periodintegerPeriod of the game (1-4 quarters; 5+ for OT).
coordinate_xintegerX coordinate on the court (half-court layout).
coordinate_yintegerY coordinate on the court (half-court layout).
media_idcharacterMedia identifier (video / image).
score_sourcecharacterWhere this game's home_score/away_score come from: 'rebuilt' (summed from the scoring plays and equal to the official final on the last play) or 'espn' (ESPN's per-play values, kept when the rebuild misses the final or the game has no final). Absent from seasons published before the repair.

Returns a tibble

col_nametypesdescription
team_idcharacterUnique team identifier.
team_uidcharacterESPN universal team identifier (UID format 's:40~l:...~t:...').
team_slugcharacterURL-safe team identifier (e.g. 'lasvegas-aces' / 'aces').
team_locationcharacterTeam city or location string.
team_namecharacterFull team display name (e.g. 'Las Vegas Aces').
team_abbreviationcharacterShort team abbreviation (e.g. 'LAS').
team_display_namecharacterFull team display name.
team_short_display_namecharacterShort team display name (e.g. 'Aces').
team_colorcharacterTeam primary color (hex without leading '#').
team_alternate_colorcharacterTeam alternate color (hex without leading '#').
team_logocharacterTeam logo image URL.
field_goals_made_field_goals_attemptedcharacterField Goals Made-Attempted.
field_goal_pctcharacterField goal percentage (0-1).
three_point_field_goals_made_three_point_field_goals_attemptedcharacter3-Point Field Goals Made-Attempted.
three_point_field_goal_pctcharacterThree-point field goal percentage (0-1).
free_throws_made_free_throws_attemptedcharacterFree Throws Made-Attempted.
free_throw_pctcharacterFree throw percentage (0-1).
total_reboundscharacterTotal rebounds.
offensive_reboundscharacterOffensive rebounds.
defensive_reboundscharacterDefensive rebounds.
assistscharacterTotal assists.
stealscharacterTotal steals.
blockscharacterTotal blocks.
turnoverscharacterTotal turnovers.
team_turnoverscharacterTeam turnovers (turnovers credited to the team rather than a player).
total_turnoverscharacterTotal turnovers (player + team).
technical_foulscharacterTotal technical fouls.
total_technical_foulscharacterTotal technical fouls (player + team).
flagrant_foulscharacterTotal flagrant fouls.
foulscharacterPersonal fouls.
largest_leadcharacterLargest lead during the game.
home_awaycharacterGame venue label ('home' or 'away').
opponent_idintegerUnique identifier for opponent.
opponent_namecharacterOpponent name.
opponent_mascotcharacterOpponent mascot.
opponent_abbrevcharacterAbbreviation for opponent.
game_idintegerUnique game identifier.
seasonintegerSeason identifier (4-digit year or 'YYYY-YY' string).
season_typeintegerSeason type (1=pre-season, 2=regular season, 3=postseason, 4=off-season for ESPN; or string label for WNBA Stats).
game_dateDateGame date (YYYY-MM-DD).

Returns a tibble

Columns as documented in the shared espn_mbb_game_all_player_schema table.

Returns a tibble

col_nametypesdescription
idintegerId.
uidcharacterESPN UID string (universal identifier).
datecharacterDate in YYYY-MM-DD format.
attendanceintegerReported attendance.
time_validlogicalTime valid.
neutral_sitelogicalNeutral site.
conference_competitionlogicalConference competition.
recentlogicalRecent.
start_datecharacterStart date (YYYY-MM-DD).
notes_typecharacterNotes type.
notes_headlinecharacterNotes headline.
type_idcharacterType identifier (numeric).
type_abbreviationcharacterType abbreviation.
venue_idcharacterUnique venue identifier.
venue_full_namecharacterVenue full name.
venue_address_citycharacterVenue address city.
venue_address_statecharacterVenue address state / region.
venue_capacityintegerVenue seating capacity.
venue_indoorlogicalTRUE if the venue is indoors.
status_clocknumericStatus clock.
status_display_clockcharacterStatus display clock.
status_periodintegerStatus period.
status_type_idcharacterUnique identifier for status type.
status_type_namecharacterStatus type name.
status_type_statecharacterStatus type state.
status_type_completedlogicalStatus type completed.
status_type_descriptioncharacterStatus type description.
status_type_detailcharacterStatus type detail.
status_type_short_detailcharacterStatus type short detail.
format_regulation_periodsintegerFormat regulation periods.
home_idcharacterUnique identifier for home.
home_uidcharacterHome team's uid.
home_locationcharacterHome team's location.
home_namecharacterHome name.
home_abbreviationcharacterHome team's abbreviation.
home_display_namecharacterHome display name.
home_short_display_namecharacterHome short display name.
home_colorcharacterColor code (hex) for home.
home_alternate_colorcharacterColor code (hex) for home alternate.
home_is_activelogicalHome team's is active.
home_venue_idcharacterUnique identifier for home venue.
home_logocharacterHome team logo URL.
home_conference_idcharacterUnique identifier for home conference.
home_scorecharacterHome team score at the time of the play.
home_winnerlogicalHome team's winner.
away_idcharacterUnique identifier for away.
away_uidcharacterAway team's uid.
away_locationcharacterAway team's location.
away_namecharacterAway name.
away_abbreviationcharacterAway team's abbreviation.
away_display_namecharacterAway display name.
away_short_display_namecharacterAway short display name.
away_colorcharacterColor code (hex) for away.
away_alternate_colorcharacterColor code (hex) for away alternate.
away_is_activelogicalAway team's is active.
away_venue_idcharacterUnique identifier for away venue.
away_logocharacterAway team logo URL.
away_conference_idcharacterUnique identifier for away conference.
away_scorecharacterAway team score at the time of the play.
away_winnerlogicalAway team's winner.
game_idintegerUnique game identifier.
seasonintegerSeason identifier (4-digit year or 'YYYY-YY' string).
season_typeintegerSeason type (1=pre-season, 2=regular season, 3=postseason, 4=off-season for ESPN; or string label for WNBA Stats).
status_type_alt_detailcharacterStatus type alt detail.
groups_idcharacterUnique identifier for groups.
groups_namecharacterGroups name.
groups_short_namecharacterGroups short name.
groups_is_conferencelogicalGroups is conference.
tournament_idnumericUnique identifier for tournament.
game_date_timePOSIXctGame start date/time (ISO 8601).
game_dateDateGame date (YYYY-MM-DD).
PBPlogical
team_boxlogicalTeam box.
player_boxlogicalPlayer box.

Returns a tibble of MBB team rosters.

Returns a tibble of MBB player season stats (long format).

Returns a tibble of MBB team season stats (long format).

Returns a tibble of MBB standings.

Returns a tibble of MBB per-game rosters.

Returns a tibble of MBB per-game officials.

Returns a tibble of MBB athlete core records (one row per athlete-season).

Returns a tibble with one row per shot attempt.

col_nametypesdescription
game_idintegerUnique game identifier.
seasonintegerSeason identifier (4-digit year).
period_numberintegerNumeric period (1-2 halves).
clock_display_valuecharacterGame clock display string (e.g. '8:32').
team_idintegerUnique team identifier.
athlete_id_1integerPrimary athlete identifier (the shooter).
athlete_id_2integerSecondary athlete identifier (e.g. assister / fouler).
type_idintegerType identifier (numeric).
type_textcharacterDisplay text for the shot/play type.
scoring_playlogicalTRUE if the play resulted in points scored.
score_valueintegerPoint value of the shot (2 / 3 / 1).
coordinate_xnumericX coordinate on the court (half-court layout).
coordinate_ynumericY coordinate on the court (half-court layout).
coordinate_x_rawnumericX coordinate as returned by the API before any adjustment.
coordinate_y_rawnumericY coordinate as returned by the API before any adjustment.
athlete_name_1characterDisplay name of the primary athlete (the shooter).
athlete_name_2characterDisplay name of the secondary athlete, when present.
team_namecharacterFull team display name.
team_mascotcharacterTeam mascot / nickname.
team_abbrevcharacterShort team abbreviation.

See also

Other hoopR Loader Functions: load_nba_pbp()

Examples

# \donttest{
load_mbb_pbp(seasons = most_recent_mbb_season())
#> Warning: cannot open URL 'https://github.com/sportsdataverse/sportsdataverse-data/releases/download/espn_mens_college_basketball_pbp/play_by_play_2027.rds': HTTP status was '404 Not Found'
#> Warning: Failed to readRDS from <https://github.com/sportsdataverse/sportsdataverse-data/releases/download/espn_mens_college_basketball_pbp/play_by_play_2027.rds>
#> ───────────────────────────────────────────────────────────────── hoopR 3.2.0 ──
#> # A tibble: 0 × 0
# }
# \donttest{
load_mbb_team_box(seasons = most_recent_mbb_season())
#> Warning: cannot open URL 'https://github.com/sportsdataverse/sportsdataverse-data/releases/download/espn_mens_college_basketball_team_boxscores/team_box_2027.rds': HTTP status was '404 Not Found'
#> Warning: Failed to readRDS from <https://github.com/sportsdataverse/sportsdataverse-data/releases/download/espn_mens_college_basketball_team_boxscores/team_box_2027.rds>
#> ───────────────────────────────────────────────────────────────── hoopR 3.2.0 ──
#> # A tibble: 0 × 0
# }
# \donttest{
load_mbb_player_box(seasons = most_recent_mbb_season())
#> Warning: cannot open URL 'https://github.com/sportsdataverse/sportsdataverse-data/releases/download/espn_mens_college_basketball_player_boxscores/player_box_2027.rds': HTTP status was '404 Not Found'
#> Warning: Failed to readRDS from <https://github.com/sportsdataverse/sportsdataverse-data/releases/download/espn_mens_college_basketball_player_boxscores/player_box_2027.rds>
#> ───────────────────────────────────────────────────────────────── hoopR 3.2.0 ──
#> # A tibble: 0 × 0
# }
# \donttest{
load_mbb_schedule(seasons = most_recent_mbb_season())
#> ── ESPN MBB schedules from hoopR data repository ──────────────── hoopR 3.2.0 ──
#> ℹ Data updated: 2026-10-18 12:35:18 UTC
#> # A tibble: 1,629 × 83
#>         id uid   date  attendance time_valid neutral_site conference_competition
#>      <int> <chr> <chr>      <dbl> <lgl>      <lgl>        <lgl>                 
#>  1  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#>  2  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#>  3  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#>  4  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#>  5  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#>  6  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#>  7  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#>  8  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#>  9  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#> 10  4.02e8 s:40… 2027…          0 FALSE      FALSE        TRUE                  
#> # ℹ 1,619 more rows
#> # ℹ 76 more variables: play_by_play_available <lgl>, recent <lgl>,
#> #   start_date <chr>, broadcast <chr>, highlights <chr>, notes_type <chr>,
#> #   notes_headline <chr>, broadcast_market <chr>, broadcast_name <chr>,
#> #   type_id <int>, type_abbreviation <chr>, venue_id <int>,
#> #   venue_full_name <chr>, venue_address_city <chr>, venue_address_state <chr>,
#> #   venue_indoor <lgl>, status_clock <dbl>, status_display_clock <chr>, …
# }
# \donttest{
load_mbb_shots(seasons = most_recent_mbb_season())
#> Warning: cannot open URL 'https://github.com/sportsdataverse/sportsdataverse-data/releases/download/espn_mens_college_basketball_shots/shots_2027.rds': HTTP status was '404 Not Found'
#> Warning: Failed to readRDS from <https://github.com/sportsdataverse/sportsdataverse-data/releases/download/espn_mens_college_basketball_shots/shots_2027.rds>
#> ───────────────────────────────────────────────────────────────── hoopR 3.2.0 ──
#> # A tibble: 0 × 0
# }