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_nba_team_box(
  seasons = most_recent_nba_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

Arguments

seasons

A vector of 4-digit years associated with given NBA seasons. (Min: 2002)

...

Additional arguments passed to an underlying function that writes the season data into a database (used by update_nba_db()).

dbConnection

A DBIConnection object, as returned by

tablename

The name of the play by play data table within the database

Value

Returns a tibble

col_nametypes
game_idinteger
seasoninteger
season_typeinteger
game_dateDate
game_date_timePOSIXct
team_idinteger
team_uidcharacter
team_slugcharacter
team_locationcharacter
team_namecharacter
team_abbreviationcharacter
team_display_namecharacter
team_short_display_namecharacter
team_colorcharacter
team_alternate_colorcharacter
team_logocharacter
team_home_awaycharacter
team_scoreinteger
team_winnerlogical
assistsinteger
blocksinteger
defensive_reboundsinteger
fast_break_pointscharacter
field_goal_pctnumeric
field_goals_madeinteger
field_goals_attemptedinteger
flagrant_foulsinteger
foulsinteger
free_throw_pctnumeric
free_throws_madeinteger
free_throws_attemptedinteger
largest_leadcharacter
offensive_reboundsinteger
points_in_paintcharacter
stealsinteger
team_turnoversinteger
technical_foulsinteger
three_point_field_goal_pctnumeric
three_point_field_goals_madeinteger
three_point_field_goals_attemptedinteger
total_reboundsinteger
total_technical_foulsinteger
total_turnoversinteger
turnover_pointscharacter
turnoversinteger
opponent_team_idinteger
opponent_team_uidcharacter
opponent_team_slugcharacter
opponent_team_locationcharacter
opponent_team_namecharacter
opponent_team_abbreviationcharacter
opponent_team_display_namecharacter
opponent_team_short_display_namecharacter
opponent_team_colorcharacter
opponent_team_alternate_colorcharacter
opponent_team_logocharacter
opponent_team_scoreinteger

Examples

# \donttest{
  load_nba_team_box(seasons = most_recent_nba_season())
#> ── ESPN NBA Team Boxscores from hoopR data repository ─────────── hoopR 2.0.1 ──
#>  Data updated: 2023-07-31 14:41:02 UTC
#> # A tibble: 2,630 × 57
#>      game_id season season_type game_date  game_date_time      team_id team_uid 
#>        <int>  <int>       <int> <date>     <dttm>                <int> <chr>    
#>  1 401544850   2023           3 2023-06-12 2023-06-12 20:30:00      14 s:40~l:4…
#>  2 401544850   2023           3 2023-06-12 2023-06-12 20:30:00       7 s:40~l:4…
#>  3 401544849   2023           3 2023-06-09 2023-06-09 20:30:00       7 s:40~l:4…
#>  4 401544849   2023           3 2023-06-09 2023-06-09 20:30:00      14 s:40~l:4…
#>  5 401544848   2023           3 2023-06-07 2023-06-07 20:30:00       7 s:40~l:4…
#>  6 401544848   2023           3 2023-06-07 2023-06-07 20:30:00      14 s:40~l:4…
#>  7 401544847   2023           3 2023-06-04 2023-06-04 20:00:00      14 s:40~l:4…
#>  8 401544847   2023           3 2023-06-04 2023-06-04 20:00:00       7 s:40~l:4…
#>  9 401544846   2023           3 2023-06-01 2023-06-01 20:30:00      14 s:40~l:4…
#> 10 401544846   2023           3 2023-06-01 2023-06-01 20:30:00       7 s:40~l:4…
#> # ℹ 2,620 more rows
#> # ℹ 50 more variables: team_slug <chr>, team_location <chr>, team_name <chr>,
#> #   team_abbreviation <chr>, team_display_name <chr>,
#> #   team_short_display_name <chr>, team_color <chr>,
#> #   team_alternate_color <chr>, team_logo <chr>, team_home_away <chr>,
#> #   team_score <int>, team_winner <lgl>, assists <int>, blocks <int>,
#> #   defensive_rebounds <int>, fast_break_points <chr>, field_goal_pct <dbl>, …
# }