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_phf_schedule(
  seasons = most_recent_phf_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

Arguments

seasons

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

...

Additional arguments passed to an underlying function that writes the season data into a database (used by update_phf_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_phf_schedule(2021))
#> ── PHF Schedule Information from fastRhockey data repository ───────────────────
#>  Data updated: 2023-01-04 07:39:26 UTC
#> # A tibble: 17 × 62
#>    type  id       league_id season_id tourn…¹ game_id number datetime           
#>    <chr> <chr>        <int>     <int> <lgl>     <int> <lgl>  <dttm>             
#>  1 game  g-379254       100      2779 NA       379254 NA     2021-03-27 19:00:00
#>  2 game  g-378721       100      2779 NA       378721 NA     2021-03-26 20:00:00
#>  3 game  g-378722       100      2779 NA       378722 NA     2021-03-26 17:00:00
#>  4 game  g-371880       100      2779 NA       371880 NA     2021-02-01 20:30:00
#>  5 game  g-371878       100      2779 NA       371878 NA     2021-01-31 19:00:00
#>  6 game  g-371881       100      2779 NA       371881 NA     2021-01-31 15:00:00
#>  7 game  g-368729       100      2779 NA       368729 NA     2021-01-30 19:00:00
#>  8 game  g-368730       100      2779 NA       368730 NA     2021-01-30 15:00:00
#>  9 game  g-368728       100      2779 NA       368728 NA     2021-01-27 20:30:00
#> 10 game  g-368727       100      2779 NA       368727 NA     2021-01-27 17:30:00
#> 11 game  g-368726       100      2779 NA       368726 NA     2021-01-26 20:30:00
#> 12 game  g-368725       100      2779 NA       368725 NA     2021-01-26 17:30:00
#> 13 game  g-368724       100      2779 NA       368724 NA     2021-01-24 19:00:00
#> 14 game  g-368720       100      2779 NA       368720 NA     2021-01-24 16:00:00
#> 15 game  g-368722       100      2779 NA       368722 NA     2021-01-24 13:00:00
#> 16 game  g-368719       100      2779 NA       368719 NA     2021-01-23 16:00:00
#> 17 game  g-368723       100      2779 NA       368723 NA     2021-01-23 13:00:00
#> # … with 54 more variables: datetime_tz <dttm>, time_zone <chr>,
#> #   time_zone_abbr <chr>, updated_at <dttm>, created_at <dttm>,
#> #   home_team_id <int>, home_team <chr>, home_team_short <chr>,
#> #   home_team_logo_url_full <chr>, home_team_logo_url_small <chr>,
#> #   home_team_logo_url_medium <chr>, home_team_logo_url_large <chr>,
#> #   home_team_logo_url_50 <chr>, home_team_logo_url_100 <chr>,
#> #   home_team_logo_url_200 <chr>, away_team_id <int>, away_team <chr>, …
# }