Skip to contents

Helper that loads multiple seasons of PWHL three-stars-of-the- game data (one to three rows per game) from the sportsdataverse-data releases either into memory or writes it into a database.

Source release tag: pwhl_three_stars. File naming convention: three_stars_{end_year}.rds.

Usage

load_pwhl_three_stars(
  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 three stars data table within the database

Value

A data frame of class fastRhockey_data. Common columns include:

columntypedescription
game_idintegerPWHL game id
starintegerstar rank (1-3)
team_idintegerstar's team id
teamcharacterstar's team name
player_idintegerstar's player id
first_namecharacterstar's first name
last_namecharacterstar's last name
jersey_numberintegerjersey number
positioncharacterposition code
is_goalieintegergoalie flag
is_homeintegerhome-team flag
goalsintegerstar's goals in this game
assistsintegerstar's assists in this game
pointsintegerstar's points in this game
savesintegersaves (goalies)
shots_againstintegershots against (goalies)

Examples

# \donttest{
  try(load_pwhl_three_stars(2024))
#> ─────────────────────────────────────────────────────────── fastRhockey 1.0.0 ──
#> # A tibble: 255 × 20
#>    game_id  star team_id team           team_abbr player_id first_name last_name
#>      <int> <int>   <int> <chr>          <chr>         <int> <chr>      <chr>    
#>  1       2     1       4 PWHL New York  NY              155 Corinne    Schroeder
#>  2       2     2       4 PWHL New York  NY               34 Alex       Carpenter
#>  3       2     3       4 PWHL New York  NY               44 Ella       Shelton  
#>  4       3     1       3 PWHL Montreal  MTL              80 Ann-Sophie Bettez   
#>  5       3     2       3 PWHL Montreal  MTL              28 Ann-Renée  Desbiens 
#>  6       3     3       5 PWHL Ottawa    OTT              61 Hayley     Scamurra 
#>  7       4     1       2 PWHL Minnesota MIN              22 Nicole     Hensley  
#>  8       4     2       2 PWHL Minnesota MIN              21 Taylor     Heise    
#>  9       4     3       1 PWHL Boston    BOS              17 Theresa    Schafzahl
#> 10       5     1       6 PWHL Toronto   TOR              64 Kristen    Campbell 
#> # ℹ 245 more rows
#> # ℹ 12 more variables: jersey_number <int>, position <chr>, is_goalie <int>,
#> #   is_home <int>, goals <int>, assists <int>, points <int>, shots <int>,
#> #   saves <int>, shots_against <int>, goals_against <int>, time_on_ice <chr>
# }