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

Arguments

seasons

A vector of 4-digit years associated with given men's college basketball seasons. (Min: 2006)

...

Additional arguments passed to an underlying function that writes the season data into a database (used by update_mbb_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

Examples

# \donttest{
load_mbb_pbp(2021)
#> ── ESPN MBB Play-by-Play Information from hoopR data repository ────────────────
#>  Data updated: 2022-03-27 18:30:47 UTC
#> # A tibble: 1,273,763 × 53
#>    shooting_play seque…¹ perio…² perio…³ home_…⁴ scori…⁵ clock…⁶ team_id type_id
#>    <lgl>         <chr>   <chr>     <int>   <int> <lgl>   <chr>   <chr>   <chr>  
#>  1 TRUE          101805… 1st Ha…       1       0 FALSE   19:47   2229    558    
#>  2 FALSE         101805… 1st Ha…       1       0 FALSE   19:44   2229    586    
#>  3 TRUE          101805… 1st Ha…       1       0 TRUE    19:42   2229    558    
#>  4 FALSE         101807… 1st Ha…       1       0 FALSE   19:22   2454    598    
#>  5 FALSE         101807… 1st Ha…       1       0 FALSE   19:22   2229    607    
#>  6 FALSE         101807… 1st Ha…       1       0 FALSE   19:20   2229    598    
#>  7 TRUE          101809… 1st Ha…       1       0 FALSE   19:08   2454    558    
#>  8 FALSE         101809… 1st Ha…       1       0 FALSE   19:03   2454    586    
#>  9 TRUE          101809… 1st Ha…       1       2 TRUE    19:01   2454    558    
#> 10 TRUE          101815… 1st Ha…       1       2 FALSE   18:45   2229    558    
#> # … with 1,273,753 more rows, 44 more variables: type_text <chr>,
#> #   away_score <int>, id <dbl>, text <chr>, score_value <int>,
#> #   participants_0_athlete_id <chr>, participants_1_athlete_id <chr>,
#> #   season <int>, season_type <int>, away_team_id <int>, away_team_name <chr>,
#> #   away_team_mascot <chr>, away_team_abbrev <chr>, away_team_name_alt <chr>,
#> #   home_team_id <int>, home_team_name <chr>, home_team_mascot <chr>,
#> #   home_team_abbrev <chr>, home_team_name_alt <chr>, home_team_spread <dbl>, …
# }