helper that loads multiple seasons from the data repo either into memory or writes it into a db using some forwarded arguments in the dots

load_nhl_pbp(
  seasons = most_recent_nhl_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

Arguments

seasons

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

...

Additional arguments passed to an underlying function that writes the season data into a database (used by update_nhl_db()).

dbConnection

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

tablename

The name of the play by play data table within the database

Value

A dataframe

Examples

# \donttest{
load_nhl_pbp(2021)
#> # A tibble: 294,936 × 35
#>    result_event   result_event_code result_event_type_id result_description     
#>    <chr>          <chr>             <chr>                <chr>                  
#>  1 Game Scheduled PHI1              GAME_SCHEDULED       Game Scheduled         
#>  2 Period Ready   PHI5              PERIOD_READY         Period Ready           
#>  3 Period Start   PHI51             PERIOD_START         Period Start           
#>  4 Faceoff        PHI52             FACEOFF              Sidney Crosby faceoff …
#>  5 Shot           PHI53             SHOT                 Travis Konecny Wrist S…
#>  6 Takeaway       PHI8              TAKEAWAY             Takeaway by Ivan Provo…
#>  7 Blocked Shot   PHI54             BLOCKED_SHOT         Sean Couturier shot bl…
#>  8 Shot           PHI9              SHOT                 Evan Rodrigues Wrist S…
#>  9 Hit            PHI10             HIT                  Kevin Hayes hit John M…
#> 10 Hit            PHI11             HIT                  Joel Farabee hit John …
#> # … with 294,926 more rows, and 31 more variables: about_event_idx <int>,
#> #   about_event_id <int>, about_period <int>, about_period_type <chr>,
#> #   about_ordinal_num <chr>, about_period_time <chr>,
#> #   about_period_time_remaining <chr>, about_date_time <chr>,
#> #   about_goals_away <int>, about_goals_home <int>, coordinates_x <int>,
#> #   coordinates_y <int>, team_id <int>, team_name <chr>, team_link <chr>,
#> #   team_tri_code <chr>, player_type_1 <chr>, player_id_1 <int>, …
# }