Skip to contents

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

Usage

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

Arguments

seasons

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

...

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 schedule data table within the database

Value

Returns a tibble

Examples

# \donttest{
  try(load_nhl_schedule(2021))
#> ── NHL Schedule Information from fastRhockey data repository ───────────────────
#>  Data updated: 2023-01-05 10:02:15 UTC
#> # A tibble: 952 × 28
#>       game_id link   game_…¹ seaso…² game_date_time      statu…³ statu…⁴ statu…⁵
#>         <int> <chr>  <chr>     <int> <dttm>              <chr>     <int> <chr>  
#>  1 2020030415 /api/… P        2.02e7 2021-07-08 00:00:00 Final         7 Final  
#>  2 2020030414 /api/… P        2.02e7 2021-07-06 00:00:00 Final         7 Final  
#>  3 2020030413 /api/… P        2.02e7 2021-07-03 00:00:00 Final         7 Final  
#>  4 2020030412 /api/… P        2.02e7 2021-07-01 00:00:00 Final         7 Final  
#>  5 2020030411 /api/… P        2.02e7 2021-06-29 00:00:00 Final         7 Final  
#>  6 2020030327 /api/… P        2.02e7 2021-06-26 00:00:00 Final         7 Final  
#>  7 2020030316 /api/… P        2.02e7 2021-06-25 00:00:00 Final         7 Final  
#>  8 2020030326 /api/… P        2.02e7 2021-06-24 00:00:00 Final         7 Final  
#>  9 2020030315 /api/… P        2.02e7 2021-06-23 01:00:00 Final         7 Final  
#> 10 2020030325 /api/… P        2.02e7 2021-06-22 00:00:00 Final         7 Final  
#> # … with 942 more rows, 20 more variables: status_status_code <int>,
#> #   status_start_time_tbd <lgl>, away_score <int>, away_team_id <int>,
#> #   away_team_name <chr>, away_team_link <chr>, home_score <int>,
#> #   home_team_id <int>, home_team_name <chr>, home_team_link <chr>,
#> #   venue_name <chr>, venue_link <chr>, venue_id <int>, content_link <chr>,
#> #   game_type <chr>, game_date <IDate>, season <int>, PBP <lgl>,
#> #   team_box <lgl>, player_box <lgl>, and abbreviated variable names …
# }