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_schedule(
  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
idinteger
uidcharacter
datecharacter
attendanceinteger
time_validlogical
neutral_sitelogical
conference_competitionlogical
recentlogical
start_datecharacter
notes_typecharacter
notes_headlinecharacter
type_idinteger
type_abbreviationcharacter
venue_idinteger
venue_full_namecharacter
venue_address_citycharacter
venue_capacityinteger
venue_indoorlogical
status_clockinteger
status_display_clockcharacter
status_periodinteger
status_type_idinteger
status_type_namecharacter
status_type_statecharacter
status_type_completedlogical
status_type_descriptioncharacter
status_type_detailcharacter
status_type_short_detailcharacter
format_regulation_periodsinteger
home_idinteger
home_uidcharacter
home_locationcharacter
home_namecharacter
home_abbreviationcharacter
home_display_namecharacter
home_short_display_namecharacter
home_colorcharacter
home_alternate_colorcharacter
home_is_activelogical
home_venue_idinteger
home_logocharacter
home_scoreinteger
home_winnerlogical
away_idinteger
away_uidcharacter
away_locationcharacter
away_namecharacter
away_abbreviationcharacter
away_display_namecharacter
away_short_display_namecharacter
away_colorcharacter
away_alternate_colorcharacter
away_is_activelogical
away_venue_idinteger
away_logocharacter
away_scoreinteger
away_winnerlogical
game_idinteger
seasoninteger
season_typeinteger
venue_address_statecharacter
status_type_alt_detailcharacter
PBPlogical
team_boxlogical
player_boxlogical
game_date_timePOSIXct
game_dateDate

Examples

# \donttest{
  load_nba_schedule(seasons = most_recent_nba_season())
#> ── ESPN NBA Schedule from hoopR data repository ───────────────── hoopR 2.1.0 ──
#>  Data updated: 2023-11-28 12:31:18 UTC
#> # A tibble: 1,207 × 76
#>         id uid   date  attendance time_valid neutral_site conference_competition
#>      <int> <chr> <chr>      <dbl> <lgl>      <lgl>        <lgl>                 
#>  1  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#>  2  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#>  3  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#>  4  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#>  5  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#>  6  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#>  7  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#>  8  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#>  9  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#> 10  4.02e8 s:40… 2024…          0 TRUE       FALSE        FALSE                 
#> # ℹ 1,197 more rows
#> # ℹ 69 more variables: play_by_play_available <lgl>, recent <lgl>,
#> #   start_date <chr>, notes_type <chr>, notes_headline <chr>,
#> #   broadcast_market <chr>, broadcast_name <chr>, type_id <int>,
#> #   type_abbreviation <chr>, venue_id <int>, venue_full_name <chr>,
#> #   venue_address_city <chr>, venue_capacity <dbl>, venue_indoor <lgl>,
#> #   status_clock <dbl>, status_display_clock <chr>, status_period <dbl>, …
# }