Skip to contents

Helper that loads multiple seasons of pre-scraped NHL schedule data from the sportsdataverse-data releases. The schedule includes data-availability flags for each game.

Usage

load_nhl_schedule(
  seasons = most_recent_nhl_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

Arguments

seasons

A vector of 4-digit years (the end year of the NHL season; e.g., 2026 for the 2025-26 season). Min: 2011.

...

Additional arguments passed to an underlying function.

dbConnection

A DBIConnection object, as returned by DBI::dbConnect()

tablename

The name of the schedule data table within the database

Value

A data frame (fastRhockey_data) with the following columns:

col_nametypesdescription
game_idintegerUnique game identifier.
season_fullcharacterFull season label (e.g. 20212022).
game_typecharacterGame type the row belongs to (regular/playoffs).
game_datecharacterGame date.
game_timecharacterScheduled start time of the game.
home_team_abbrcharacterHome team abbreviation.
away_team_abbrcharacterAway team abbreviation.
home_team_namecharacterHome team name.
away_team_namecharacterAway team name.
home_scoreintegerHome team final score.
away_scoreintegerAway team final score.
game_statecharacterGame status (e.g. FINAL/FUT).
venuecharacterVenue where the game was played.
seasonintegerSeason (concluding year, YYYY).
game_jsonlogicalWhether processed game JSON is available.
game_json_urlglueURL to the processed game JSON.
PBPlogicalWhether play-by-play data is available.
team_boxlogicalWhether team box score data is available.
player_boxlogicalWhether player box score data is available.

Examples

# \donttest{
  try(load_nhl_schedule(2022))
#> ── NHL Schedule from fastRhockey data repository ────────── fastRhockey 1.0.0 ──
#>  Data updated: 2026-04-08 05:45:20 UTC
#> # A tibble: 1,504 × 19
#>       game_id season_full game_type game_date  game_time          home_team_abbr
#>         <int> <chr>       <chr>     <chr>      <chr>              <chr>         
#>  1 2021030416 20212022    P         2022-06-26 2022-06-27T00:00:… TBL           
#>  2 2021030415 20212022    P         2022-06-24 2022-06-25T00:00:… COL           
#>  3 2021030414 20212022    P         2022-06-22 2022-06-23T00:00:… TBL           
#>  4 2021030413 20212022    P         2022-06-20 2022-06-21T00:00:… TBL           
#>  5 2021030412 20212022    P         2022-06-18 2022-06-19T00:00:… COL           
#>  6 2021030411 20212022    P         2022-06-15 2022-06-16T00:00:… COL           
#>  7 2021030316 20212022    P         2022-06-11 2022-06-12T00:00:… TBL           
#>  8 2021030315 20212022    P         2022-06-09 2022-06-10T00:00:… NYR           
#>  9 2021030314 20212022    P         2022-06-07 2022-06-08T00:00:… TBL           
#> 10 2021030324 20212022    P         2022-06-06 2022-06-07T00:00:… EDM           
#> # ℹ 1,494 more rows
#> # ℹ 13 more variables: away_team_abbr <chr>, home_team_name <chr>,
#> #   away_team_name <chr>, home_score <int>, away_score <int>, game_state <chr>,
#> #   venue <chr>, season <int>, game_json <lgl>, game_json_url <glue>,
#> #   PBP <lgl>, team_box <lgl>, player_box <lgl>
# }