Skip to contents

Loads the on-court lineups for every event of the WNBA Stats API play-by-play: one row per game and action_number, with the five home and five away player ids on the floor at that event. Join it to load_wnba_stats_pbp() on game_id + action_number. Backed by the wnba_stats_game_lineups release tag (assets wnba_lineups_{season}, labelled by the calendar year the season was played).

Usage

load_wnba_stats_game_lineups(
  seasons = most_recent_wnba_stats_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

Arguments

seasons

A vector of 4-digit years associated with given WNBA seasons. Published coverage runs 1997 through the most recent season, with no gaps. Pass seasons = TRUE for every published season. (Min: 1997)

...

Additional arguments passed to an underlying function that writes the season data into a database.

dbConnection

A DBIConnection object, as returned by DBI::dbConnect()

tablename

The name of the game lineups data table within the database

Value

Returns a wehoop_data tibble with one row per play-by-play event.

col_nametypesdescription
game_idcharacterUnique game identifier (10-digit, zero-padded).
action_numberintegerPlay-by-play action number within the game.
periodintegerPeriod of the game.
home_player_1integerHome lineup slot 1 player identifier.
home_player_2integerHome lineup slot 2 player identifier.
home_player_3integerHome lineup slot 3 player identifier.
home_player_4integerHome lineup slot 4 player identifier.
home_player_5integerHome lineup slot 5 player identifier.
away_player_1integerAway lineup slot 1 player identifier.
away_player_2integerAway lineup slot 2 player identifier.
away_player_3integerAway lineup slot 3 player identifier.
away_player_4integerAway lineup slot 4 player identifier.
away_player_5integerAway lineup slot 5 player identifier.
seasonintegerSeason identifier (4-digit year).

Examples

# \donttest{
  # A season of this table is a multi-MB download, so the example runs interactively only.
  try(load_wnba_stats_game_lineups(seasons = most_recent_wnba_stats_season()))
#> ──────────────────────────────────────────────────────────────── wehoop 3.1.0 ──
#> # A tibble: 149,921 × 14
#>    game_id    action_number period home_player_1 home_player_2 home_player_3
#>    <chr>              <int>  <int>         <int>         <int>         <int>
#>  1 1022600001             2      1        204335       1627668       1627673
#>  2 1022600001             4      1        204335       1627668       1627673
#>  3 1022600001             7      1        204335       1627668       1627673
#>  4 1022600001             8      1        204335       1627668       1627673
#>  5 1022600001             9      1        204335       1627668       1627673
#>  6 1022600001            11      1        204335       1627668       1627673
#>  7 1022600001            13      1        204335       1627668       1627673
#>  8 1022600001            15      1        204335       1627668       1627673
#>  9 1022600001            16      1        204335       1627668       1627673
#> 10 1022600001            17      1        204335       1627668       1627673
#> # ℹ 149,911 more rows
#> # ℹ 8 more variables: home_player_4 <int>, home_player_5 <int>,
#> #   away_player_1 <int>, away_player_2 <int>, away_player_3 <int>,
#> #   away_player_4 <int>, away_player_5 <int>, season <int>
# }