Skip to contents

Helper that loads multiple seasons of NHL goal-scoring event data from the sportsdataverse-data releases.

Usage

load_nhl_scoring(
  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 goal and the following columns:

col_nametypesdescription
situationCodecharacterStrength/situation code for the goal.
eventIdintegerNHL event identifier.
strengthcharacterStrength state at which the goal was scored.
playerIdintegerPlayer id of the goal scorer.
firstNamelistScorer first name (localized list).
lastNamelistScorer last name (localized list).
namelistScorer display name (localized list).
teamAbbrevlistScoring team abbreviation (localized list).
headshotcharacterURL to the scorer headshot image.
highlightClipSharingUrlcharacterShareable URL for the goal highlight clip.
highlightClipnumericHighlight clip identifier.
discreteClipnumericDiscrete clip identifier.
goalsToDateintegerScorer goal total to date in the season.
awayScoreintegerAway team score after the goal.
homeScoreintegerHome team score after the goal.
leadingTeamAbbrevlistAbbreviation of the leading team (localized list).
timeInPeriodcharacterTime within the period the goal was scored.
shotTypecharacterType of shot on the goal.
goalModifiercharacterGoal modifier (e.g. empty-net, power-play).
assistslistList of assisting players on the goal.
pptReplayUrlcharacterURL to the power-play replay, if any.
homeTeamDefendingSidecharacterSide of the ice the home team defended.
isHomelogicalWhether the scoring team is the home team.
period_numberintegerPeriod number the goal was scored in.
period_typecharacterPeriod type (REG/OT/SO).

Examples

# \donttest{
  try(load_nhl_scoring(2026))
#> ── NHL scoring summary ──────────────────────────────────── fastRhockey 1.0.0 ──
#>  Data updated: 2026-07-22 23:49:22 UTC
#> # A tibble: 8,691 × 48
#>    situationCode eventId strength playerId firstName.default firstName.cs
#>    <chr>           <int> <chr>       <int> <chr>             <chr>       
#>  1 1551              258 ev        8483493 Frank             NA          
#>  2 1551              274 ev        8478421 A.J.              NA          
#>  3 1451              366 pp        8477409 Carter            NA          
#>  4 1551              630 ev        8476882 Teuvo             NA          
#>  5 1551             1101 ev        8480003 Jesper            NA          
#>  6 1551              481 ev        8479638 Justin            NA          
#>  7 1560             1123 ev        8479638 Justin            NA          
#>  8 1560              112 ev        8481481 Blake             NA          
#>  9 1551              562 ev        8480039 Martin            NA          
#> 10 1551              647 ev        8484258 Sam               NA          
#> # ℹ 8,681 more rows
#> # ℹ 42 more variables: firstName.de <chr>, firstName.es <chr>,
#> #   firstName.fi <chr>, firstName.sk <chr>, firstName.sv <chr>,
#> #   firstName.fr <chr>, lastName.default <chr>, lastName.cs <chr>,
#> #   lastName.fi <chr>, lastName.sk <chr>, lastName.de <chr>, lastName.es <chr>,
#> #   lastName.sv <chr>, name.default <chr>, name.cs <chr>, name.de <chr>,
#> #   name.fi <chr>, name.sk <chr>, name.sv <chr>, teamAbbrev.default <chr>, …
# }