Skip to contents

Helper that loads multiple seasons of pre-scraped PWHL schedule data from the sportsdataverse-data releases either into memory or writes it into a database.

Usage

load_pwhl_schedule(
  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 passed to an underlying function that writes the season data into a database.

dbConnection

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

tablename

The name of the schedule data table within the database

Value

A data frame (fastRhockey_data) with the following columns:

col_nametypesdescription
game_idcharacterUnique game identifier.
seasonintegerSeason (concluding year, YYYY).
game_datecharacterGame date.
game_statuscharacterGame status text.
home_teamcharacterHome team name.
home_team_idcharacterHome team identifier.
away_teamcharacterAway team name.
away_team_idcharacterAway team identifier.
home_scorecharacterHome team final score.
away_scorecharacterAway team final score.
winnercharacterWinning team.
venuecharacterVenue name.
venue_urlcharacterVenue URL.
game_typecharacterGame type the row belongs to.
game_jsonlogicalWhether the game JSON is available.
game_json_urlglueURL to the game JSON feed.
PBPlogicalWhether play-by-play data is available.
player_boxlogicalWhether player box data is available.
skater_boxlogicalWhether skater box data is available.
goalie_boxlogicalWhether goalie box data is available.
team_boxlogicalWhether team box data is available.
game_infologicalWhether game info data is available.
game_rosterslogicalWhether game rosters data is available.
scoring_summarylogicalWhether scoring summary data is available.
penalty_summarylogicalWhether penalty summary data is available.
three_starslogicalWhether three stars data is available.
officialslogicalWhether officials data is available.
shots_by_periodlogicalWhether shots-by-period data is available.
shootoutlogicalWhether shootout data is available.

Examples

# \donttest{
  try(load_pwhl_schedule(2024))
#> ─────────────────────────────────────────────────────────── fastRhockey 1.0.0 ──
#> # A tibble: 85 × 29
#>    game_id season game_date   game_status home_team home_team_id away_team
#>    <chr>    <int> <chr>       <chr>       <chr>     <chr>        <chr>    
#>  1 84        2024 Wed, May 8  Final       Toronto   6            Minnesota
#>  2 98        2024 Wed, May 29 Final       Boston    1            Minnesota
#>  3 90        2024 Wed, May 15 Final OT2   Minnesota 2            Toronto  
#>  4 63        2024 Wed, May 1  Final       Toronto   6            Minnesota
#>  5 45        2024 Wed, Mar 6  Final       Toronto   6            Boston   
#>  6 46        2024 Wed, Mar 6  Final       New York  4            Montreal 
#>  7 52        2024 Wed, Mar 20 Final       Toronto   6            Boston   
#>  8 53        2024 Wed, Mar 20 Final       New York  4            Ottawa   
#>  9 50        2024 Wed, Mar 13 Final       Minnesota 2            Boston   
#> 10 4         2024 Wed, Jan 3  Final       Boston    1            Minnesota
#> # ℹ 75 more rows
#> # ℹ 22 more variables: away_team_id <chr>, home_score <chr>, away_score <chr>,
#> #   winner <chr>, venue <chr>, venue_url <chr>, game_type <chr>,
#> #   game_json <lgl>, game_json_url <glue>, PBP <lgl>, player_box <lgl>,
#> #   skater_box <lgl>, goalie_box <lgl>, team_box <lgl>, game_info <lgl>,
#> #   game_rosters <lgl>, scoring_summary <lgl>, penalty_summary <lgl>,
#> #   three_stars <lgl>, officials <lgl>, shots_by_period <lgl>, shootout <lgl>
# }