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_rosters(
  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_phf_db()).

dbConnection

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

tablename

The name of the team rosters data table within the database

Value

Returns a tibble

Examples

# \donttest{
  try(load_nhl_rosters(2021))
#> ── NHL Team Roster Information from fastRhockey data repository ────────────────
#>  Data updated: 2023-01-05 10:02:24 UTC
#> # A tibble: 1,078 × 10
#>    jersey_number playe…¹ playe…² playe…³ posit…⁴ posit…⁵ posit…⁶ posit…⁷ team_id
#>    <chr>           <int> <chr>   <chr>   <chr>   <chr>   <chr>   <chr>     <int>
#>  1 14            8471233 Travis… /api/v… C       Center  Forward C             1
#>  2 76            8474056 P.K. S… /api/v… D       Defens… Defens… D             1
#>  3 21            8475151 Kyle P… /api/v… C       Center  Forward C             1
#>  4 29            8475179 Dmitry… /api/v… D       Defens… Defens… D             1
#>  5 45            8475222 Sami V… /api/v… D       Defens… Defens… D             1
#>  6 7             8476807 Matt T… /api/v… D       Defens… Defens… D             1
#>  7 28            8476850 Ryan M… /api/v… D       Defens… Defens… D             1
#>  8 28            8476923 Damon … /api/v… D       Defens… Defens… D             1
#>  9 58            8476941 Connor… /api/v… D       Defens… Defens… D             1
#> 10 97            8477038 Nikita… /api/v… L       Left W… Forward LW            1
#> # … with 1,068 more rows, 1 more variable: season <int>, and abbreviated
#> #   variable names ¹​player_id, ²​player_full_name, ³​player_link, ⁴​position_code,
#> #   ⁵​position_name, ⁶​position_type, ⁷​position_abbreviation
# }