Skip to contents

fastRhockey

fastRhockey is an R package for accessing hockey data from the NHL (National Hockey League) and PWHL (Professional Women’s Hockey League) via public web APIs. It provides 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 are deprecated as of v1.0.0. 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 development version from GitHub with:

# You can install using the pak package using the following code:
if (!requireNamespace('pak', quietly = TRUE)){
  install.packages('pak')
}
pak::pak("sportsdataverse/fastRhockey")

If you would prefer the remotes installation:

if (!requireNamespace('remotes', quietly = TRUE)){
  install.packages('remotes')
}
remotes::install_github(repo = "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)

# 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)

Documentation

You can find the documentation for fastRhockey on GitHub pages.

There is also a printable fastRhockey cheat sheet (PDF), one of a set covering every SportsDataverse package.

You can view CSVs of historical boxscore and play-by-play on the fastRhockey data repo, as well as the process for scraping that historical data.


Follow the SportsDataverse (@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.

Citations

To cite the fastRhockey R package in publications, use:

BibTeX Citation

@misc{howell_gilani_fastRhockey,
  author = {Ben Howell and Saiem Gilani},
  title = {fastRhockey: Functions to Access Professional Women's Hockey League and National Hockey League Play by Play Data.},
  url = {https://fastRhockey.sportsdataverse.org/},
  doi = {10.32614/CRAN.package.fastRhockey},
  year = {2026}
}