Learn R Programming

wehoop (version 3.0.0)

load_wnba_pbp: Load cleaned WNBA play-by-play from the data repo

Description

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

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

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

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

load_wnba_rosters_manifest() returns the per-season manifest CSV (season, row_count, generated_at_utc, source_endpoint) for the rosters release tag without downloading any season's full data.

load_wnba_player_stats_manifest() returns the per-season manifest CSV (season, row_count, generated_at_utc, source_endpoint) for the player season stats release tag without downloading any season's full data.

load_wnba_team_stats_manifest() returns the per-season manifest CSV (season, row_count, generated_at_utc, source_endpoint) for the team season stats release tag without downloading any season's full data.

load_wnba_standings_manifest() returns the per-season manifest CSV (season, row_count, generated_at_utc, source_endpoint) for the standings release tag without downloading any season's full data.

load_wnba_draft_manifest() returns the per-season manifest CSV (season, row_count, generated_at_utc, source_endpoint) for the draft release tag without downloading any season's full data.

load_wnba_shots_manifest() returns the per-season manifest CSV (season, row_count, generated_at_utc, source_endpoint) for the shots release tag without downloading any season's full data.

load_wnba_game_rosters_manifest() returns the per-season manifest CSV (season, row_count, generated_at_utc, source_endpoint) for the game rosters release tag without downloading any season's full data.

load_wnba_officials_manifest() returns the per-season manifest CSV (season, row_count, generated_at_utc, source_endpoint) for the officials release tag without downloading any season's full data.

Loads season-level WNBA team rosters scraped from ESPN. One row per athlete-team-season triple. Backed by the wehoop-wnba-data pipeline that reads raw JSONs from wehoop-wnba-raw and publishes parquet/rds artifacts to the espn_wnba_rosters release tag.

Loads season-level WNBA player statistics scraped from ESPN. One row per athlete-team-season-statistic-grouping. Backed by the wehoop-wnba-data pipeline that reads raw JSONs from wehoop-wnba-raw and publishes parquet/rds artifacts to the espn_wnba_player_season_stats release tag.

Loads season-level WNBA team statistics scraped from ESPN. One row per team-season-statistic-grouping. Backed by the wehoop-wnba-data pipeline that reads raw JSONs from wehoop-wnba-raw and publishes parquet/rds artifacts to the espn_wnba_team_season_stats release tag.

Loads season-level WNBA standings scraped from ESPN. One row per team-season. Backed by the wehoop-wnba-data pipeline that reads raw JSONs from wehoop-wnba-raw and publishes parquet/rds artifacts to the espn_wnba_standings release tag.

Loads season-level WNBA draft picks scraped from ESPN. One row per pick. Backed by the wehoop-wnba-data pipeline that reads raw JSONs from wehoop-wnba-raw and publishes parquet/rds artifacts to the espn_wnba_draft release tag.

Loads shot events parsed from ESPN WNBA play-by-play feeds. One row per shot attempt (made or missed), with court coordinates and shot metadata. Backed by the wehoop-wnba-data pipeline that reads raw JSONs from wehoop-wnba-raw and publishes parquet/rds artifacts to the espn_wnba_shots release tag.

Loads per-game rosters scraped from ESPN WNBA box scores. One row per athlete-team-game triple, with athlete identifiers, jersey, position, starter flag, and DNP status. Backed by the wehoop-wnba-data pipeline that reads raw JSONs from wehoop-wnba-raw and publishes parquet/rds artifacts to the espn_wnba_game_rosters release tag.

Loads game-level officials data scraped from ESPN WNBA summary feeds. One row per official-game pair. Backed by the wehoop-wnba-data pipeline that reads raw JSONs from wehoop-wnba-raw and publishes parquet/rds artifacts to the espn_wnba_officials release tag.

Loads ESPN WNBA athlete core records -- identity and biographical fields, one row per athlete who appeared in the season. Backed by the wehoop-wnba-data pipeline that reads raw JSONs from wehoop-wnba-raw and publishes parquet/rds artifacts to the espn_wnba_player_core release tag.

This is the only source of athlete bio in the pipeline: the player season stats payload carries no identity at all -- not even the athlete id.

Two properties of the source are worth knowing before joining:

  • current_team_id is the athlete's CURRENT team, not their team in the requested season. Season team lives in load_wnba_player_box() / load_wnba_player_stats().

  • Bio (height / weight / jersey) is a current snapshot that ESPN overwrites in place; it is not era-correct for a historical season. The season dimension here is participation, not the bio's vintage.

Field coverage is era-dependent by nature -- headshots exist only for modern players, while college and date of birth thin out the other way.

Usage

load_wnba_pbp(
  seasons = most_recent_wnba_season(),
  ...,
  dbConnection = NULL,
  tablename = NULL
)

load_wnba_team_box( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_player_box( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_schedule( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_rosters_manifest()

load_wnba_player_stats_manifest()

load_wnba_team_stats_manifest()

load_wnba_standings_manifest()

load_wnba_draft_manifest()

load_wnba_shots_manifest()

load_wnba_game_rosters_manifest()

load_wnba_officials_manifest()

load_wnba_rosters( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_player_stats( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_team_stats( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_standings( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_draft( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_shots( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_game_rosters( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_officials( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

load_wnba_player_core( seasons = most_recent_wnba_season(), ..., dbConnection = NULL, tablename = NULL )

Value

A dataframe with 42 columns

col_namedescription
shooting_playLogical value (TRUE/FALSE) indicating whether the play was a shooting play
sequence_numberSequence number is supposed to represent a shot-possession, examine the last two numbers to see if there are multiple events that occur within the same shot-possession. A shot-possession is basically any sequence of plays until there is a shot, change in possession, and probably things like technical fouls and the like. So as soon as a shot goes up, a new sequence starts regardless, even if the shooting team retains possession via offensive or deadball rebound. The first portion of the number is usually time related (i.e. the numeric representation of when the sequence started, from a seconds remaining in the period perspective or so)
period_display_valueLong form of period (1st quarter, 2nd Quarter, OT, etc.)
period_numberThe numeric period of play in the game
home_scoreHome score at the time of the play
coordinate_xThe entire scale is a rectangle of size 25x47, intended as a half-court representation of the basketball court (i.e. on the side of the offense), with each coordinate unit representing a foot. It appears that the basket is roughly represented as the (25, 0) point. This is a nonsensical definition when considering that the basket overhangs the court, with the backboard aligned 48 inches from the baseline, then the center of the hoop being roughly 11 inches from there. This is an idiosyncracy of either sensor placement or software and data entry. Use your best judgement in making your charts, I think you will find that making some translations will be helpful.
coordinate_y
scoring_playLogical value (TRUE/FALSE) indicating whether the play was a play on which the offense scored
clock_display_valueTime left within the period
team_idUnique team identification number for the offensive team
type_idUnique play type identifcation number
type_textPlay type text description, passed through verbatim from ESPN. Note: ESPN labels the free-throw play TYPE "MadeFreeThrow" for made AND missed free throws; filter makes vs. misses with scoring_play (TRUE = made), not type_text
away_scoreAway score at the time of the play
idUnique play identifcation number
textText description of the play
score_valueThe points value of the shot taken (1 / 2 / 3). Set to the attempt's value even on misses (a missed free throw still carries 1); use scoring_play to identify points actually scored
participants_0_athlete_idUnique player identification number
participants_1_athlete_idUnique player identification number
participants_2_athlete_idUnique player identification number
type_abbreviationPlay type abbreviation
seasonSeason of the game
season_typeSeason type of the game, 1 is pre-season, 2 is regular season, 3 is post-season, 4 is off-season
away_team_idUnique away team identification number
away_team_nameAway team name
away_team_mascotAway team mascot
away_team_abbrevText abbreviation for the away team
away_team_name_altAlternate versions of the away team abbreviation
home_team_idUnique home team identification number
home_team_namehome team name
home_team_mascothome team mascot
home_team_abbrevText abbreviation for the home team
home_team_name_altAlternate versions of the home team abbreviation
home_team_spreadThe game spread with respect to the home team
game_spreadGame spread in (-X Team) format. There are almost none, I would recommend not trusting any of these three columns
home_favoriteLogical (TRUE/FALSE) indicating whether the home team is favored
clock_minutesClock minutes split from seconds for developer convenience
clock_secondsClock seconds split from minutes for developer convenience
halfHalf of the game
lag_halfA lag column on the half
lead_halfA lead column on the half
game_play_numberGame play number
game_idUnique identifier for the game event

Returns a tibble

Returns a tibble

Returns a tibble

Returns a wehoop_data tibble with one row per athlete-team-season.

Returns a wehoop_data tibble of player season stats.

Returns a wehoop_data tibble of team season stats.

Columns as documented in the shared basketball_load_wbb_team_stats_schema table.

Returns a wehoop_data tibble of team standings.

Columns as documented in the shared basketball_load_wbb_standings_schema table.

Returns a wehoop_data tibble of WNBA draft picks.

col_nametypesdescription
seasonintegerSeason identifier (4-digit year or 'YYYY-YY' string).
roundintegerTournament / playoff round.
pickintegerPick.
overallintegerOverall.
team_idcharacterUnique team identifier.
team_display_namecharacterFull team display name.
athlete_idcharacterUnique athlete identifier (ESPN).
athlete_display_namecharacterAthlete display name (full).
athlete_positioncharacterAthlete position.
college_idcharacterUnique identifier for college.
college_namecharacterCollege name.

Returns a wehoop_data tibble with one row per shot attempt.

Columns as documented in the shared basketball_load_wbb_shots_schema table.

Returns a wehoop_data tibble with one row per athlete-team-game.

Columns as documented in the shared basketball_load_wbb_game_rosters_schema table.

Returns a wehoop_data tibble with one row per official-game pair.

Columns as documented in the shared basketball_load_wbb_officials_schema table.

Returns a wehoop_data tibble of athlete core records.

Arguments

seasons

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

...

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 player core table within the database

Examples

Run this code
# \donttest{
  try(load_wnba_pbp())
# }
# \donttest{
  try(load_wnba_team_box())
# }
# \donttest{
  try(load_wnba_player_box())
# }
# \donttest{
  try(load_wnba_schedule())
# }
# \donttest{
  try(load_wnba_rosters(seasons = most_recent_wnba_season()))
# }
# \donttest{
  try(load_wnba_player_stats(seasons = most_recent_wnba_season()))
# }
# \donttest{
  try(load_wnba_team_stats(seasons = most_recent_wnba_season()))
# }
# \donttest{
  try(load_wnba_standings(seasons = most_recent_wnba_season()))
# }
# \donttest{
  try(load_wnba_draft(seasons = most_recent_wnba_season()))
# }
# \donttest{
  try(load_wnba_shots(seasons = most_recent_wnba_season()))
# }
# \donttest{
  try(load_wnba_game_rosters(seasons = most_recent_wnba_season()))
# }
# \donttest{
  try(load_wnba_officials(seasons = most_recent_wnba_season()))
# }
# \donttest{
  try(load_wnba_player_core(seasons = most_recent_wnba_season()))
# }

Run the code above in your browser using DataLab