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_team_box(
  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 team box data table within the database

Value

Returns a tibble

Examples

# \donttest{
  try(load_phf_team_box(2021))
#> ── PHF Team Boxscore Information from fastRhockey data repository ──────────────
#>  Data updated: 2023-01-04 07:38:01 UTC
#> # A tibble: 34 × 26
#>    team  game_id winner total_…¹ succe…² power…³ power…⁴ penal…⁵ faceo…⁶ block…⁷
#>    <chr>   <int> <lgl>     <int>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
#>  1 bos    379254 TRUE          4       2       3   0.667      17   0.684       9
#>  2 min    379254 FALSE         3       1       2   0.5         4   0.316       8
#>  3 ctw    378721 FALSE         0       0       1   0           0   0.524       6
#>  4 min    378721 TRUE          7       0       0   0           2   0.476       2
#>  5 bos    378722 TRUE          6       0       1   0           2   0.474      15
#>  6 tor    378722 FALSE         2       0       2   0           2   0.526      11
#>  7 buf    371880 FALSE         1       0       5   0          14   0.2        18
#>  8 bos    371880 TRUE          7       2       7   0.286       8   0.8        10
#>  9 tor    371878 TRUE          6       1       5   0.2         4   0.436       3
#> 10 ctw    371878 FALSE         0       0       2   0          10   0.564      14
#> # … with 24 more rows, 16 more variables: takeaways <dbl>, giveaways <dbl>,
#> #   period_1_shots <int>, period_2_shots <int>, period_3_shots <int>,
#> #   overtime_shots <int>, shootout_made_shots <int>,
#> #   shootout_missed_shots <int>, total_shots <int>, period_1_scoring <int>,
#> #   period_2_scoring <int>, period_3_scoring <int>, overtime_scoring <int>,
#> #   shootout_made_scoring <dbl>, shootout_missed_scoring <dbl>, season <int>,
#> #   and abbreviated variable names ¹​total_scoring, ²​successful_power_play, …
# }