Skip to contents

fastRhockey is an R package for accessing hockey data via public web APIs: the NHL (National Hockey League), the PWHL (Professional Women’s Hockey League), the AHL and the three Canadian major-junior leagues (OHL, WHL, QMJHL), thirteen European leagues, and NCAA men’s and women’s college hockey through ESPN. It exports 880 functions that return structured data frames of play-by-play, schedule, standings, roster, draft, player stats, and team data. The package also includes integrated expected goals (xG) models trained via XGBoost.

Part of the SportsDataverse family of R/Python packages for sports analytics.

Key Features

Note: PHF (Premier Hockey Federation) functions have been defunct since v1.0.0: they stop with an error. The league ceased operations; use PWHL functions instead.

fastRhockey holographic logo banner


Data status

The load_nhl_*() and load_pwhl_*() functions read release assets on sportsdataverse-data. The badges below are rebuilt nightly from each producer’s latest workflow run and newest release files; idle means the sport is out of season. Full detail: sportsdataverse.org/status.

Dataset Data updated Through Pipeline Update workflows
NHL fastRhockey-nhl-data data updated fastRhockey-nhl-data through season fastRhockey-nhl-data pipeline state fastRhockey-nhl-data daily_nhl_python fastRhockey-nhl-data nhl_model_pipeline
PWHL fastRhockey-pwhl-data data updated fastRhockey-pwhl-data through season fastRhockey-pwhl-data pipeline state fastRhockey-pwhl-data daily_pwhl_python fastRhockey-pwhl-data pwhl_xg_cron
Conference, division and ballpark reference sdv-reference-data data updated sdv-reference-data through season sdv-reference-data pipeline state —

Installation

You can install the CRAN version of fastRhockey with:

install.packages("fastRhockey")

You can install the latest build from R-universe with:

install.packages("fastRhockey", repos = c("https://sportsdataverse.r-universe.dev", getOption("repos")))

You can install the development version of fastRhockey from GitHub with:

if (!requireNamespace("pak", quietly = TRUE)) install.packages("pak")
pak::pak("sportsdataverse/fastRhockey")
# or, with remotes:
# if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes")
# remotes::install_github("sportsdataverse/fastRhockey")

Quick start

library(fastRhockey)

# NHL
nhl_schedule(season = "20242025")
nhl_standings(season = "20242025")
nhl_game_feed(game_id = 2024020001)

# NHL Edge advanced metrics
nhl_edge_skater_detail(player_id = 8478402)               # Connor McDavid, current season
nhl_edge_goalie_save_percentage_detail(player_id = 8475883)
nhl_edge_team_zone_time_details(team_id = 10)             # Toronto Maple Leafs

# NHL Records API
nhl_records_franchise()
nhl_records_draft_lottery_odds()
nhl_records_skater_real_time_stats_career(limit = 50)

# Helper aggregators
nhl_game_ids_by_season(season = 2025, team_abbr = "TOR")
nhl_player_career_stats(player_id = 8478402)
nhl_team_summary_range(start_season = 2023, end_season = 2024)

# PWHL
pwhl_schedule(season = 2025)
pwhl_standings(season = 2025)
pwhl_pbp(game_id = 27)
pwhl_player_info(player_id = 28)
pwhl_leaders(position = "skaters", season = 2025)
pwhl_game_summary(game_id = 27)

# ESPN and Fox Sports NHL
espn_nhl_scoreboard(dates = 20250301)
fox_nhl_standings(team_id = "1")

# AHL, OHL, WHL and QMJHL (HockeyTech)
ahl_schedule(season = 2026)

# European leagues (seasons are end years: 2026 = 2025-26)
liiga_schedule(season = 2026)
khl_standings(season = 2026)

# NCAA men's and women's college hockey (ESPN)
espn_mch_scoreboard(dates = 20250301)
espn_wch_standings()

# Full season loaders
load_nhl_pbp(seasons = 2024)
load_nhl_schedule(seasons = 2024)
load_pwhl_pbp(seasons = 2024)
load_pwhl_schedule(seasons = 2024)
load_pwhl_team_box(seasons = 2024)
load_pwhl_skater_box(seasons = 2024)
load_pwhl_scoring_summary(seasons = 2024)
load_pwhl_penalty_summary(seasons = 2024)
load_pwhl_game_info(seasons = 2024)

Companion packages

  • sdvplotR (pak::pak("sportsdataverse/sdvplotR")) adds NHL team logos and colours to ggplot2 charts and draws shot maps from the fastRhockey loaders; see its NHL visualization and NHL shot map articles.
  • sportyR (install.packages("sportyR")) draws regulation rinks (sportyR::geom_hockey("nhl")) to plot the x_coord_fixed / y_coord_fixed play-by-play coordinates on.
  • hockeyR (Daniel Morse) is the other NHL play-by-play package for R. The fastRhockey NHL xG feature pipeline is adapted from hockeyR’s.
  • sportsdataverse-py is the Python package; most fastRhockey functions have a Python twin of the same name.

The SportsDataverse

fastRhockey is part of the SportsDataverse, a set of open-source packages for sports data.

Package Sport / Scope
cfbfastR College football
hoopR Men’s basketball (NBA and NCAA)
wehoop Women’s basketball (WNBA and NCAA)
fastRhockey Hockey (NHL and PWHL)
baseballr Baseball (MLB, MiLB, NCAA)
softballR College softball
oddsapiR Sports betting odds
recruitR College football recruiting
usfootballR US soccer
cfbseedR · cfb4th CFB playoff simulation · fourth-down decisions
cfbplotR · sdvplotR · sportyR Logos, colors, tables · playing surfaces
sportsdataverse-R Umbrella R metapackage
sportsdataverse-py · sportsdataverse.js Python and Node.js

See the full ecosystem at sportsdataverse.org.

Follow the SportsDataverse on X and star this repo

X Follow

GitHub stars

Star history of sportsdataverse/fastRhockey

Our Authors

Our Contributors (they’re awesome)

Cheat sheet

A printable one-page reference for fastRhockey — the function families, the loaders, and what each one returns.

📄 Download the fastRhockey cheat sheet (PDF)

Free to download, print and hand out; light and dark, US Letter landscape. Every SportsDataverse package has one — browse them all at sportsdataverse.org/cheatsheets.

Code of Conduct

Please note that the fastRhockey project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Citations

To cite the fastRhockey R package in publications, use:

BibTeX Citation

@Manual{howell_gilani_fastRhockey,
  author = {Ben Howell and Saiem Gilani},
  title = {fastRhockey: Functions to Access Hockey Play by Play Data and Statistics},
  note = {R package version 1.1.0},
  url = {https://fastRhockey.sportsdataverse.org/},
  doi = {10.32614/CRAN.package.fastRhockey},
  year = {2026}
}

License

fastRhockey is released under the MIT License (MIT + file LICENSE).