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_team_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 byDBI::dbConnect()
- tablename
The name of the team box data table within the database
Examples
# \donttest{
try(load_nhl_team_box(2021))
#> ── NHL Team Boxscore Information from fastRhockey data repository ──────────────
#> ℹ Data updated: 2023-01-05 10:01:54 UTC
#> # A tibble: 1,904 × 18
#> team_id team_name link abbre…¹ tri_c…² goals pim shots power…³ power…⁴
#> <int> <chr> <chr> <chr> <chr> <int> <int> <int> <chr> <int>
#> 1 8 Montréal Can… /api… MTL MTL 0 8 22 0.0 0
#> 2 14 Tampa Bay Li… /api… TBL TBL 1 8 30 0.0 0
#> 3 14 Tampa Bay Li… /api… TBL TBL 2 12 34 0.0 0
#> 4 8 Montréal Can… /api… MTL MTL 3 20 21 0.0 0
#> 5 14 Tampa Bay Li… /api… TBL TBL 6 2 30 100.0 1
#> 6 8 Montréal Can… /api… MTL MTL 3 2 35 0.0 0
#> 7 8 Montréal Can… /api… MTL MTL 1 20 43 33.3 1
#> 8 14 Tampa Bay Li… /api… TBL TBL 3 20 23 0.0 0
#> 9 8 Montréal Can… /api… MTL MTL 1 8 19 0.0 0
#> 10 14 Tampa Bay Li… /api… TBL TBL 5 6 27 33.3 1
#> # … with 1,894 more rows, 8 more variables: power_play_opportunities <int>,
#> # face_off_win_percentage <chr>, blocked <int>, takeaways <int>,
#> # giveaways <int>, hits <int>, game_id <int>, season <int>, and abbreviated
#> # variable names ¹abbreviation, ²tri_code, ³power_play_percentage,
#> # ⁴power_play_goals
# }