Skip to contents

Retrieve boxscore data for a specific NHL game from the NHL web API (api-web.nhle.com).

Usage

nhl_game_boxscore(game_id)

Arguments

game_id

(integer) NHL game ID, e.g. 2024020001.

Value

A named list of data frames: game_info, team_box, skater_stats, goalie_stats.

game_info

col_nametypesdescription
game_idintegerUnique game identifier.
seasonintegerSeason (concluding year, YYYY).
game_typeintegerGame type code (2 = regular, 3 = playoffs).
game_datecharacterGame date.
venuecharacterVenue name.
game_statecharacterGame state (e.g., FINAL, LIVE).
away_team_idintegerAway team identifier.
away_team_abbrevcharacterAway team abbreviation.
away_team_namecharacterAway team name.
away_scoreintegerAway team final score.
away_sogintegerAway team shots on goal.
home_team_idintegerHome team identifier.
home_team_abbrevcharacterHome team abbreviation.
home_team_namecharacterHome team name.
home_scoreintegerHome team final score.
home_sogintegerHome team shots on goal.
last_period_typecharacterType of the last period played (REG, OT, SO).

team_box

col_nametypesdescription
home_awaycharacterHome or away indicator.
team_idintegerUnique team identifier.
team_abbrevcharacterTeam abbreviation.
team_namecharacterTeam name.
goalsintegerGoals scored.
shots_on_goalintegerShots on goal.
pimintegerPenalty minutes.
hitsintegerHits.
blocked_shotsintegerBlocked shots.
giveawaysintegerGiveaways.
takeawaysintegerTakeaways.
power_play_goalsintegerPower-play goals.
faceoff_win_pctgnumericFaceoff win percentage.
savesintegerSaves made.
save_pctgnumericSave percentage.
goals_againstintegerGoals against.

skater_stats

col_nametypesdescription
home_awaycharacterHome or away indicator.
team_idintegerUnique team identifier.
team_abbrevcharacterTeam abbreviation.
player_idintegerUnique player identifier.
player_namecharacterPlayer name.
sweater_numberintegerJersey number.
positioncharacterPlayer position.
goalsintegerGoals scored.
assistsintegerAssists.
pointsintegerTotal points (goals + assists).
plus_minusintegerPlus/minus rating.
pimintegerPenalty minutes.
hitsintegerHits.
power_play_goalsintegerPower-play goals.
shots_on_goalintegerShots on goal.
faceoff_winning_pctgnumericFaceoff win percentage.
toicharacterTime on ice.
blocked_shotsintegerBlocked shots.
shiftsintegerNumber of shifts.
giveawaysintegerGiveaways.
takeawaysintegerTakeaways.

goalie_stats

col_nametypesdescription
home_awaycharacterHome or away indicator.
team_idintegerUnique team identifier.
team_abbrevcharacterTeam abbreviation.
player_idintegerUnique player identifier.
player_namecharacterPlayer name.
sweater_numberintegerJersey number.
even_strength_shots_againstcharacterEven-strength shots against (saves/total).
power_play_shots_againstcharacterPower-play shots against (saves/total).
shorthanded_shots_againstcharacterShorthanded shots against (saves/total).
save_shots_againstcharacterTotal shots against (saves/total).
save_pctgnumericSave percentage.
even_strength_goals_againstintegerEven-strength goals against.
power_play_goals_againstintegerPower-play goals against.
shorthanded_goals_againstintegerShorthanded goals against.
pimintegerPenalty minutes.
goals_againstintegerGoals against.
toicharacterTime on ice.
starterlogicalWhether the goalie started the game.
decisioncharacterGoalie decision (W, L, O).
shots_againstintegerShots faced.
savesintegerSaves made.

Details

Uses the endpoint https://api-web.nhle.com/v1/gamecenter/{game_id}/boxscore.

Examples

# \donttest{
  try({
    box <- nhl_game_boxscore(2024020001)
    box$game_info
    box$skater_stats
  })
#> ── NHL Game Skater Stats from NHL.com ───────────────────── fastRhockey 1.1.0 ──
#> ℹ Data updated: 2026-11-13 21:32:24 UTC
#> # A tibble: 36 × 21
#>    home_away team_id team_abbrev player_id player_name sweater_number position
#>    <chr>       <int> <chr>           <int> <chr>                <int> <chr>   
#>  1 away            1 NJD           8476474 S. Noesen               11 R       
#>  2 away            1 NJD           8480002 N. Hischier             13 C       
#>  3 away            1 NJD           8479414 N. Bastian              14 R       
#>  4 away            1 NJD           8476292 O. Palat                18 L       
#>  5 away            1 NJD           8478414 T. Meier                28 R       
#>  6 away            1 NJD           8477508 C. Lazar                42 C       
#>  7 away            1 NJD           8481032 P. Cotter               47 L       
#>  8 away            1 NJD           8475287 E. Haula                56 L       
#>  9 away            1 NJD           8479407 J. Bratt                63 L       
#> 10 away            1 NJD           8481559 J. Hughes               86 C       
#> # ℹ 26 more rows
#> # ℹ 14 more variables: goals <int>, assists <int>, points <int>,
#> #   plus_minus <int>, pim <int>, hits <int>, power_play_goals <int>,
#> #   shots_on_goal <int>, faceoff_winning_pctg <dbl>, toi <chr>,
#> #   blocked_shots <int>, shifts <int>, giveaways <int>, takeaways <int>
# }