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

Value

Returns a tibble

Examples

# \donttest{
  try(load_phf_player_box(2021))
#> ── PHF Player Boxscore Information from fastRhockey data repository ────────────
#>  Data updated: 2023-01-04 07:39:26 UTC
#> # A tibble: 672 × 31
#>    player_…¹ playe…² posit…³ goals assists points penal…⁴ plus_…⁵ shots…⁶ blocks
#>        <int> <chr>   <chr>   <int>   <int>  <int>   <int>   <int>   <int>  <int>
#>  1         3 Jonna … F           0       2      2       0       2       4      2
#>  2         9 Allie … F           2       0      2       0       2       7      0
#>  3        15 Meagha… F           1       1      2       0       2       1      0
#>  4         5 Winny … D           0       1      1       0       1       0      0
#>  5        21 Audra … F           0       1      1       0       1       3      1
#>  6         4 Chelse… D           0       0      0       0      -2       0      0
#>  7         8 Amanda… D           0       0      0       0       1       3      1
#>  8        11 Lisa M… F           0       0      0       2      -1       0      1
#>  9        18 Stepha… F           0       0      0       0      -2       1      1
#> 10        19 Haley … F           0       0      0       0      -1       5      0
#> # … with 662 more rows, 21 more variables: giveaways <int>, takeaways <int>,
#> #   faceoffs_won_lost <chr>, faceoffs_win_pct <dbl>, powerplay_goals <int>,
#> #   shorthanded_goals <int>, shots <int>, shots_blocked <int>,
#> #   faceoffs_won <int>, faceoffs_lost <int>, team <chr>, skaters_href <chr>,
#> #   player_id <chr>, game_id <int>, minutes_played <chr>, shots_against <int>,
#> #   goals_against <int>, saves <int>, save_percent <dbl>, goalies_href <chr>,
#> #   season <int>, and abbreviated variable names ¹​player_jersey, …
# }