OHLpkg Logo

Complete Access to Ontario Hockey League Data

`OHLpkg` is an R package that provides programmatic access to OHL data: player stats, goalie stats, team info, game schedules, and play-by-play events. Built for analysts, fans, and developers.

View on GitHub

About OHLpkg

The Ontario Hockey League (OHL) is one of the premier junior leagues in the world. `OHLpkg` bridges R with the OHL’s data sources, pulling JSON feeds directly from HockeyTech. This package removes the need for manual scraping, and outputs clean, ready-to-analyze data frames.

Supported data spans 1998 → 2026, including regular season, playoffs, and selected pre-season datasets.

Functions Overview

get_Stats(season_name, team)

Returns filtered skater stats (GP > 9). Now includes optional team filter.

get_RawStats(season_name, team)

Returns full skater stats (no GP cutoff). Includes team filter.

get_GoalieStats(season_name, team)

Goalie stats (GP > 9). Includes team filter for v2.5.0.

get_EVStats()

Even-strength stats: calculates EVG, EVA, EVPTS, EVPTS/G, EVPTS%.

get_SHStats()

Short-handed stats, structured like EVStats but for SH goals/assists/points.

get_DYStats(season_name)

Filters draft-year eligible skaters (DY-0) based on dynamic birthdate cutoffs per season.

get_RKStats(season_name, team)

Filters rookie skaters (first OHL season). Team filter supported.

get_Teams(team)

Returns metadata for all 20 OHL teams, or a single team if specified.

get_Schedule(season_name)

Returns league schedule and results. Supports season argument.

get_GameEvents(game_id)

Play-by-play log for a specific game ID (goals, penalties, shots).

get_PlayerInfo(season_name)

Player profile/metrics: height, weight, birthdate, position, team.

Arguments & Filters

Usage Examples


# Install and load
devtools::install_github("NoahCornish/OHLpkg")
library(OHLpkg)

# Example 1: Get raw skater stats for 2026 Season
df <- get_RawStats(season_name = "2026 Season")

# Example 2: Filter by team
knights <- get_Stats("2026 Season", team = "London Knights")

# Example 3: Get goalie stats
goalies <- get_GoalieStats("2026 Season", team = "Ottawa 67's")

# Example 4: Game events
events <- get_GameEvents(game_id = 28151)
head(events)
    

Changelog

Future Roadmap