Skip to contents

Aggregator helper that iterates every NHL team's season roster (via nhl_teams_roster()) and flattens forwards, defensemen, and goalies into a single tidy data frame. Mirrors the Helpers.all_players convenience helper from the nhl-api-py Python client.

Usage

nhl_all_players_by_season(season, sleep_rate = 0)

Arguments

season

Integer four-digit year representing the start year of the season (e.g. 2024 for the 2024-25 season), matching the convention used by nhl_teams_roster().

sleep_rate

Numeric seconds to Sys.sleep() between per-team API calls. Defaults to 0 (no delay).

Value

A data frame (fastRhockey_data) with the following columns:

col_nametypesdescription
player_idintegerUnique player identifier.
first_namecharacterPlayer first name.
last_namecharacterPlayer last name.
full_namecharacterPlayer full name.
sweater_numberintegerJersey number.
position_codecharacterPlayer position code.
shoots_catchescharacterHandedness (shoots/catches).
height_inchesintegerPlayer height in inches.
weight_poundsintegerPlayer weight in pounds.
birth_datecharacterPlayer birth date.
birth_citycharacterPlayer birth city.
birth_countrycharacterPlayer birth country.
headshot_urlcharacterURL to the player headshot image.
team_abbrcharacterTeam abbreviation.
seasonnumericSeason start year (e.g., 2024 for 2024-25).

Examples

# \donttest{
  try(nhl_all_players_by_season(season = 2024))
#> ── NHL All Players by Season ────────────────────────────── fastRhockey 1.0.0 ──
#> ℹ Data updated: 2026-10-08 12:58:52 UTC
#> # A tibble: 853 × 15
#>    player_id first_name last_name  full_name        sweater_number position_code
#>        <int> <chr>      <chr>      <chr>                     <int> <chr>        
#>  1   8477979 Nicolas    Aube-Kubel Nicolas Aube-Ku…             96 F            
#>  2   8482132 Brett      Berard     Brett Berard                 65 F            
#>  3   8477380 Jonny      Brodzinski Jonny Brodzinski             22 F            
#>  4   8475842 Sam        Carrick    Sam Carrick                  39 F            
#>  5   8482157 Will       Cuylle     Will Cuylle                  50 F            
#>  6   8481726 Adam       Edstrom    Adam Edstrom                 84 F            
#>  7   8481560 Arthur     Kaliyev    Arthur Kaliyev               34 F            
#>  8   8482109 Alexis     Lafrenière Alexis Lafreniè…             13 F            
#>  9   8476468 J.T.       Miller     J.T. Miller                   8 F            
#> 10   8482747 Brennan    Othmann    Brennan Othmann              78 F            
#> # ℹ 843 more rows
#> # ℹ 9 more variables: shoots_catches <chr>, height_inches <int>,
#> #   weight_pounds <int>, birth_date <chr>, birth_city <chr>,
#> #   birth_country <chr>, headshot_url <chr>, team_abbr <chr>, season <dbl>
# }