Skip to contents

Helper that loads multiple seasons of NHL per-period shot totals (one row per team per period per game) from the sportsdataverse-data releases.

Usage

load_nhl_shots_by_period(
  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 data table within the database

Value

A data frame (fastRhockey_data) with one row per team per period per game and the following columns:

col_nametypesdescription
game_idintegerUnique game identifier.
seasonintegerSeason (concluding year, YYYY).
game_datecharacterGame date.
home_awaycharacterHome or away indicator.
period_numberintegerPeriod number (1-3 regulation, 4+ for OT/SO).
period_typecharacterPeriod type (REG/OT/SO).
shotsintegerShots on goal in the period.

Examples

# \donttest{
  try(load_nhl_shots_by_period(2026))
#> ─────────────────────────────────────────────────────────── fastRhockey 1.0.0 ──
#> # A tibble: 4,647 × 9
#>     away  home    game_id   season game_date  period period_type
#>    <int> <int>      <int>    <int> <chr>       <int> <chr>      
#>  1     3    17 2025020001 20252026 2025-10-07      1 REG        
#>  2    11     9 2025020001 20252026 2025-10-07      2 REG        
#>  3     5    11 2025020001 20252026 2025-10-07      3 REG        
#>  4     8     7 2025020002 20252026 2025-10-07      1 REG        
#>  5     8    13 2025020002 20252026 2025-10-07      2 REG        
#>  6    15     5 2025020002 20252026 2025-10-07      3 REG        
#>  7     7     6 2025020003 20252026 2025-10-07      1 REG        
#>  8    11     5 2025020003 20252026 2025-10-07      2 REG        
#>  9     5    14 2025020003 20252026 2025-10-07      3 REG        
#> 10    11     8 2025020004 20252026 2025-10-08      1 REG        
#> # ℹ 4,637 more rows
#> # ℹ 2 more variables: max_regulation_periods <int>, ot_periods <int>
# }