Skip to contents

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

Source release tag: pwhl_game_info. File naming convention: game_info_{end_year}.rds.

Usage

load_pwhl_game_info(
  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 game info data table within the database

Value

A data frame (fastRhockey_data) with the following columns:

col_nametypesdescription
game_idintegerUnique game identifier.
game_numbercharacterLeague game number.
game_datecharacterHuman-readable game date.
game_date_isocharacterISO-8601 game start datetime.
start_timecharacterStart time (local).
end_timecharacterEnd time (local).
game_durationcharacterGame length (H:MM).
game_venuecharacterVenue name.
attendanceintegerReported attendance.
game_statuscharacterGame status text.
game_season_idintegerHockeyTech season identifier.
startedintegerFlag for whether the game has started.
finalintegerFlag for whether the game is final.
home_team_idintegerHome team identifier.
home_teamcharacterHome team name.
home_team_abbrcharacterHome team abbreviation.
home_scoreintegerHome team final score.
away_team_idintegerAway team identifier.
away_teamcharacterAway team name.
away_team_abbrcharacterAway team abbreviation.
away_scoreintegerAway team final score.
has_shootoutintegerFlag for whether the game went to shootout.
game_report_urlcharacterURL to the game report.
boxscore_urlcharacterURL to the boxscore.

Examples

# \donttest{
  try(load_pwhl_game_info(2024))
#> ─────────────────────────────────────────────────────────── fastRhockey 1.0.0 ──
#> # A tibble: 85 × 24
#>    game_id game_number game_date game_date_iso start_time end_time game_duration
#>      <int> <chr>       <chr>     <chr>         <chr>      <chr>    <chr>        
#>  1       2 1           Monday, … 2024-01-01T1… 12:48 pm … 3:15 pm… 2:27         
#>  2       3 2           Tuesday,… 2024-01-02T1… 7:12 pm E… 9:35 pm… 2:23         
#>  3       4 3           Wednesda… 2024-01-03T1… 7:14 pm E… 9:35 pm… 2:21         
#>  4       5 4           Friday, … 2024-01-05T1… 7:15 pm E… 9:40 pm… 2:25         
#>  5       6 5           Saturday… 2024-01-06T1… 2:42 pm C… 5:03 pm… 2:21         
#>  6       8 7           Wednesda… 2024-01-10T1… 7:08 pm C… 9:28 pm… 2:20         
#>  7       9 8           Wednesda… 2024-01-10T1… 7:11 pm E… 9:37 pm… 2:26         
#>  8      10 9           Saturday… 2024-01-13T1… 1:09 pm E… 3:25 pm… 2:16         
#>  9      11 10          Saturday… 2024-01-13T1… 3:48 pm E… 6:18 pm… 2:30         
#> 10      12 11          Sunday, … 2024-01-14T1… 3:08 pm C… 5:32 pm… 2:24         
#> # ℹ 75 more rows
#> # ℹ 17 more variables: game_venue <chr>, attendance <int>, game_status <chr>,
#> #   game_season_id <int>, started <int>, final <int>, home_team_id <int>,
#> #   home_team <chr>, home_team_abbr <chr>, home_score <int>,
#> #   away_team_id <int>, away_team <chr>, away_team_abbr <chr>,
#> #   away_score <int>, has_shootout <int>, game_report_url <chr>,
#> #   boxscore_url <chr>
# }