Skip to contents

Helper that loads multiple seasons of PWHL per-game rosters (one row per player per game, including starters and scratches) from the sportsdataverse-data releases either into memory or writes it into a database.

Source release tag: pwhl_game_rosters. File naming convention: game_rosters_{end_year}.rds. Distinct from load_pwhl_rosters(), which returns season-level team rosters.

Usage

load_pwhl_game_rosters(
  seasons = most_recent_pwhl_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

Arguments

seasons

A vector of 4-digit years associated with given PWHL seasons. (Min: 2024)

...

Additional arguments (currently unused; kept for API symmetry).

dbConnection

A DBIConnection object, as returned by DBI::dbConnect()

tablename

The name of the per-game rosters data table within the database

Value

A data frame (fastRhockey_data) with the following columns:

col_nametypesdescription
game_idintegerUnique game identifier.
team_idintegerUnique team identifier.
teamcharacterTeam name.
team_abbrcharacterTeam abbreviation.
team_sidecharacterHome or away indicator.
player_typecharacterPlayer type (skater or goalie).
player_idintegerUnique player identifier.
first_namecharacterPlayer first name.
last_namecharacterPlayer last name.
jersey_numberintegerJersey number.
positioncharacterPlayer position.
birth_datecharacterPlayer birth date.
startingintegerWhether the player started the game.
statuscharacterStatus string (e.g. captain markers).

Examples

# \donttest{
  try(load_pwhl_game_rosters(2024))
#> ─────────────────────────────────────────────────────────── fastRhockey 1.0.0 ──
#> # A tibble: 3,545 × 14
#>    game_id team_id team     team_abbr team_side player_type player_id first_name
#>      <int>   <int> <chr>    <chr>     <chr>     <chr>           <int> <chr>     
#>  1       2       6 PWHL To… TOR       home      skater             71 Jocelyne  
#>  2       2       6 PWHL To… TOR       home      skater            133 Lauriane  
#>  3       2       6 PWHL To… TOR       home      skater             68 Kali      
#>  4       2       6 PWHL To… TOR       home      skater            131 Olivia    
#>  5       2       6 PWHL To… TOR       home      skater            101 Alexa     
#>  6       2       6 PWHL To… TOR       home      skater             74 Allie     
#>  7       2       6 PWHL To… TOR       home      skater             67 Renata    
#>  8       2       6 PWHL To… TOR       home      skater            126 Samantha  
#>  9       2       6 PWHL To… TOR       home      skater             65 Jesse     
#> 10       2       6 PWHL To… TOR       home      skater             72 Rebecca   
#> # ℹ 3,535 more rows
#> # ℹ 6 more variables: last_name <chr>, jersey_number <int>, position <chr>,
#> #   birth_date <chr>, starting <int>, status <chr>
# }