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_player_box(
  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 player box data table within the database

Value

Returns a tibble

Examples

# \donttest{
  try(load_nhl_player_box(2021))
#> ── NHL Player Boxscore Information from fastRhockey data repository ────────────
#>  Data updated: 2023-01-05 10:02:14 UTC
#> # A tibble: 36,276 × 50
#>    playe…¹ playe…² link  shoot…³ roste…⁴ jerse…⁵ posit…⁶ posit…⁷ posit…⁸ posit…⁹
#>      <int> <chr>   <chr> <chr>   <chr>   <chr>   <chr>   <chr>   <chr>   <chr>  
#>  1 8476967 Brett … /api… L       Y       77      D       Defens… Defens… D      
#>  2 8476469 Joel A… /api… R       Y       40      R       Right … Forward RW     
#>  3 8471679 Carey … /api… L       Y       31      G       Goalie  Goalie  G      
#>  4 8470642 Shea W… /api… R       Y       6       D       Defens… Defens… D      
#>  5 8470621 Corey … /api… R       Y       94      R       Right … Forward RW     
#>  6 8478133 Jake E… /api… R       Y       71      C       Center  Forward C      
#>  7 8481014 Alexan… /api… L       Y       27      D       Defens… Defens… D      
#>  8 8473507 Jeff P… /api… R       Y       26      D       Defens… Defens… D      
#>  9 8474038 Paul B… /api… L       Y       41      L       Left W… Forward LW     
#> 10 8475726 Tyler … /api… R       Y       73      R       Right … Forward RW     
#> # … with 36,266 more rows, 40 more variables: skater_stats_time_on_ice <chr>,
#> #   skater_stats_assists <int>, skater_stats_goals <int>,
#> #   skater_stats_shots <int>, skater_stats_hits <int>,
#> #   skater_stats_power_play_goals <int>, skater_stats_power_play_assists <int>,
#> #   skater_stats_penalty_minutes <int>, skater_stats_face_off_wins <int>,
#> #   skater_stats_faceoff_taken <int>, skater_stats_takeaways <int>,
#> #   skater_stats_giveaways <int>, skater_stats_short_handed_goals <int>, …
# }