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.


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.

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 on Twitter and star this repo

Twitter Follow

GitHub stars

Our Authors

Our Contributors (they’re awesome)

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 = {2025}
}