Returns information on game shifts for a given game id
Value
A data frame (fastRhockey_data) with one row per shift change and
the following columns:
| col_name | types | description |
| event_team | character | Team making the line change. |
| period | integer | Period number. |
| period_time | character | Time in the period of the change (MM:SS). |
| period_seconds | numeric | Seconds elapsed in the period. |
| game_seconds | numeric | Seconds elapsed in the game. |
| num_on | integer | Number of players coming on the ice. |
| players_on | character | Names of players coming on the ice. |
| ids_on | character | Player IDs coming on the ice. |
| num_off | integer | Number of players going off the ice. |
| players_off | character | Names of players going off the ice. |
| ids_off | character | Player IDs going off the ice. |
| event | character | Event label ("Change"). |
| event_type | character | Event type code ("CHANGE"). |
| game_seconds_remaining | numeric | Seconds 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>
# }
