Skip to contents

Returns information on game shifts for a given game id

Usage

nhl_game_shifts(game_id)

Arguments

game_id

Game unique ID

Value

A data frame (fastRhockey_data) with one row per shift change and the following columns:

col_nametypesdescription
event_teamcharacterTeam making the line change.
periodintegerPeriod number.
period_timecharacterTime in the period of the change (MM:SS).
period_secondsnumericSeconds elapsed in the period.
game_secondsnumericSeconds elapsed in the game.
num_onintegerNumber of players coming on the ice.
players_oncharacterNames of players coming on the ice.
ids_oncharacterPlayer IDs coming on the ice.
num_offintegerNumber of players going off the ice.
players_offcharacterNames of players going off the ice.
ids_offcharacterPlayer IDs going off the ice.
eventcharacterEvent label ("Change").
event_typecharacterEvent type code ("CHANGE").
game_seconds_remainingnumericSeconds remaining in the game.

Source of truth is the legacy stats-API shiftcharts endpoint (api.nhle.com/stats/rest/en/shiftcharts). When that endpoint returns {total: 0, data: []} – which has become common for 2024-25 and 2025-26 regular-season games – we fall back to scraping the legacy HTML TOI reports at nhl.com/scores/htmlreports/{season}/T{H|V}{gameno}.HTM, which still publish per-shift records for the same games.

Examples

# \donttest{
  try(nhl_game_shifts(game_id = 2021020182))
#> ── NHL Game Shifts Information from NHL.com ─────────────── fastRhockey 1.0.0 ──
#>  Data updated: 2026-06-13 04:21:25 UTC
#> # A tibble: 326 × 14
#>    event_team   period period_time period_seconds game_seconds num_on players_on
#>    <chr>         <int> <chr>                <dbl>        <dbl>  <int> <chr>     
#>  1 Boston Brui…      1 00:00                    0            0      6 Patrice B…
#>  2 Ottawa Sena…      1 00:00                    0            0      6 Matt Murr…
#>  3 Boston Brui…      1 00:18                   18           18      1 Matt Grze…
#>  4 Ottawa Sena…      1 00:18                   18           18      5 Michael D…
#>  5 Boston Brui…      1 00:41                   41           41      2 Craig Smi…
#>  6 Ottawa Sena…      1 00:46                   46           46      3 Thomas Ch…
#>  7 Boston Brui…      1 00:56                   56           56      2 Charlie C…
#>  8 Ottawa Sena…      1 00:58                   58           58      2 Zach Sanf…
#>  9 Boston Brui…      1 01:14                   74           74      5 Erik Haul…
#> 10 Ottawa Sena…      1 01:14                   74           74      5 Michael D…
#> # ℹ 316 more rows
#> # ℹ 7 more variables: ids_on <chr>, num_off <int>, players_off <chr>,
#> #   ids_off <chr>, event <chr>, event_type <chr>, game_seconds_remaining <dbl>
# }