
Getting Started with wehoop
Saiem Gilani
Source: vignettes/getting-started-wehoop.Rmd
getting-started-wehoop.RmdWelcome folks,
I’m Saiem Gilani, one of the authors of wehoop,
and I hope to give the community a high-quality resource for accessing
women’s basketball data for statistical analysis, basketball research,
and more. I am excited to show you some of what you can do with this
edition of the package.
Installing R and RStudio
- Head to https://cran.r-project.org
- Select the appropriate link for your operating system (Windows, Mac OS X, or Linux)
- Windows - Select base and download the most recent version
- Mac OS X - Select Latest Release, but check to make sure your OS is the correct version. Look through Binaries for Legacy OS X Systems if you are on an older release
- Linux - Select the appropriate distro and follow the installation instructions
- Head to Posit.co
- Follow the associated download and installation instructions for RStudio.
- Start peering over the RStudio IDE Cheatsheet. An IDE is an integrated development environment.
- For Windows users: I recommend you install Rtools. This is not an R package! It is “a collection of resources for building packages for R under Microsoft Windows, or for building R itself”. Go to https://cran.r-project.org/bin/windows/Rtools/ and follow the directions for installation.
Install wehoop
# You can install using the pak package using the following code:
if (!requireNamespace('pak')){
install.packages('pak')
}
pak::pkg_install(c("wehoop", "dplyr", "glue", "progressr", "tictoc"))Quick Start
WNBA full play-by-play seasons (2002-2025) ~ 30-60 seconds
tictoc::tic()
progressr::with_progress({
wnba_pbp <- wehoop::load_wnba_pbp()
})
tictoc::toc()## 1.109 sec elapsed
## 13.91 sec elapsed
glue::glue("{nrow(wnba_pbp)} rows of WNBA play-by-play data from {length(unique(wnba_pbp$game_id))} games.")## 121342 rows of WNBA play-by-play data from 312 games.
## 1782985 rows of WNBA play-by-play data from 4674 games.
dplyr::glimpse(wnba_pbp)## Rows: 121,342
## Columns: 62
## $ game_play_number <int> 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,…
## $ id <dbl> 4018203294, 4018203297, 4018203298, 40…
## $ sequence_number <int> 4, 7, 8, 9, 10, 11, 12, 13, 15, 16, 17…
## $ type_id <int> 615, 131, 155, 95, 156, 125, 131, 44, …
## $ type_text <chr> "Jumpball", "Pullup Jump Shot", "Defen…
## $ text <chr> "NaLyssa Smith vs. Natasha Mack (Alyss…
## $ away_score <int> 0, 0, 0, 0, 0, 2, 2, 2, 3, 4, 4, 4, 4,…
## $ home_score <int> 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 4, 4, 4,…
## $ period_number <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ period_display_value <chr> "1st Quarter", "1st Quarter", "1st Qua…
## $ clock_display_value <chr> "10:00", "9:48", "9:45", "9:28", "9:22…
## $ scoring_play <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, TRU…
## $ score_value <int> 0, 0, 0, 0, 0, 2, 2, 0, 1, 1, 2, 0, 0,…
## $ team_id <int> 11, 11, 17, 17, 17, 17, 11, 11, 17, 17…
## $ athlete_id_1 <int> 4068042, 2998938, 4065870, 4398776, 43…
## $ athlete_id_2 <int> 4398776, NA, NA, NA, NA, NA, NA, NA, N…
## $ athlete_id_3 <int> 2529140, NA, NA, NA, NA, NA, NA, NA, N…
## $ wallclock <chr> "2025-10-11T00:08:16Z", "2025-10-11T00…
## $ shooting_play <lgl> FALSE, TRUE, FALSE, TRUE, FALSE, TRUE,…
## $ coordinate_x_raw <dbl> -214748340, 35, 35, 28, 28, 21, 30, 26…
## $ coordinate_y_raw <dbl> -214748365.00, 22.00, 22.00, 1.00, 1.0…
## $ game_id <int> 401820329, 401820329, 401820329, 40182…
## $ season <int> 2025, 2025, 2025, 2025, 2025, 2025, 20…
## $ season_type <int> 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,…
## $ home_team_id <int> 11, 11, 11, 11, 11, 11, 11, 11, 11, 11…
## $ home_team_name <chr> "Phoenix", "Phoenix", "Phoenix", "Phoe…
## $ home_team_mascot <chr> "Mercury", "Mercury", "Mercury", "Merc…
## $ home_team_abbrev <chr> "PHX", "PHX", "PHX", "PHX", "PHX", "PH…
## $ home_team_name_alt <chr> "Phoenix", "Phoenix", "Phoenix", "Phoe…
## $ away_team_id <int> 17, 17, 17, 17, 17, 17, 17, 17, 17, 17…
## $ away_team_name <chr> "Las Vegas", "Las Vegas", "Las Vegas",…
## $ away_team_mascot <chr> "Aces", "Aces", "Aces", "Aces", "Aces"…
## $ away_team_abbrev <chr> "LV", "LV", "LV", "LV", "LV", "LV", "L…
## $ away_team_name_alt <chr> "Las Vegas", "Las Vegas", "Las Vegas",…
## $ game_spread <dbl> 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5…
## $ home_favorite <lgl> TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TR…
## $ game_spread_available <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FAL…
## $ home_team_spread <dbl> 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5, 2.5…
## $ qtr <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ time <chr> "10:00", "9:48", "9:45", "9:28", "9:22…
## $ clock_minutes <int> 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8, 8…
## $ clock_seconds <dbl> 0, 48, 45, 28, 22, 21, 14, 1, 1, 1, 43…
## $ home_timeout_called <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FAL…
## $ away_timeout_called <lgl> FALSE, FALSE, FALSE, FALSE, FALSE, FAL…
## $ half <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ game_half <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ lead_qtr <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ lead_half <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ start_quarter_seconds_remaining <dbl> 600, 588, 585, 568, 562, 561, 554, 541…
## $ start_half_seconds_remaining <dbl> 1200, 1188, 1185, 1168, 1162, 1161, 11…
## $ start_game_seconds_remaining <dbl> 2400, 2388, 2385, 2368, 2362, 2361, 23…
## $ end_quarter_seconds_remaining <dbl> 600, 585, 568, 562, 561, 554, 541, 541…
## $ end_half_seconds_remaining <dbl> 1200, 1185, 1168, 1162, 1161, 1154, 11…
## $ end_game_seconds_remaining <dbl> 2400, 2385, 2368, 2362, 2361, 2354, 23…
## $ period <int> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,…
## $ lag_qtr <int> NA, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
## $ lag_half <int> NA, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…
## $ coordinate_x <dbl> 214748406.75, 19.75, -19.75, -40.75, -…
## $ coordinate_y <dbl> 214748365, -10, 10, 3, 3, -4, -5, -1, …
## $ game_date <date> 2025-10-10, 2025-10-10, 2025-10-10, 2…
## $ game_date_time <dttm> 2025-10-10 20:00:00, 2025-10-10 20:00…
## $ type_abbreviation <chr> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
WNBA full team box score seasons (2003-2025) ~ 5-30 seconds
tictoc::tic()
progressr::with_progress({
wnba_team_box <- wehoop::load_wnba_team_box()
})
tictoc::toc()## 0.394 sec elapsed
glue::glue("{nrow(wnba_team_box)} rows of WNBA team boxscore data from {length(unique(wnba_team_box$game_id))} games.")## 624 rows of WNBA team boxscore data from 312 games.
dplyr::glimpse(wnba_team_box)## Rows: 624
## Columns: 57
## $ game_id <int> 401820329, 401820329, 401820326, 401…
## $ season <int> 2025, 2025, 2025, 2025, 2025, 2025, …
## $ season_type <int> 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, …
## $ game_date <date> 2025-10-10, 2025-10-10, 2025-10-08,…
## $ game_date_time <dttm> 2025-10-10 20:00:00, 2025-10-10 20:…
## $ team_id <int> 17, 11, 17, 11, 11, 17, 11, 17, 5, 1…
## $ team_uid <chr> "s:40~l:59~t:17", "s:40~l:59~t:11", …
## $ team_slug <chr> "las-vegas-aces", "phoenix-mercury",…
## $ team_location <chr> "Las Vegas", "Phoenix", "Las Vegas",…
## $ team_name <chr> "Aces", "Mercury", "Aces", "Mercury"…
## $ team_abbreviation <chr> "LV", "PHX", "LV", "PHX", "PHX", "LV…
## $ team_display_name <chr> "Las Vegas Aces", "Phoenix Mercury",…
## $ team_short_display_name <chr> "Aces", "Mercury", "Aces", "Mercury"…
## $ team_color <chr> "a7a8aa", "3c286e", "a7a8aa", "3c286…
## $ team_alternate_color <chr> "000000", "e56020", "000000", "e5602…
## $ team_logo <chr> "https://a.espncdn.com/i/teamlogos/w…
## $ team_home_away <chr> "away", "home", "away", "home", "awa…
## $ team_score <int> 97, 86, 90, 88, 78, 91, 86, 89, 98, …
## $ team_winner <lgl> TRUE, FALSE, TRUE, FALSE, FALSE, TRU…
## $ assists <int> 19, 17, 21, 17, 17, 21, 20, 24, 21, …
## $ blocks <int> 6, 5, 8, 2, 1, 6, 4, 3, 1, 10, 6, 3,…
## $ defensive_rebounds <int> 22, 33, 24, 23, 26, 34, 29, 25, 28, …
## $ fast_break_points <chr> "9", "10", "13", "15", "17", "13", "…
## $ field_goal_pct <dbl> 38.9, 49.2, 42.6, 43.9, 40.8, 49.3, …
## $ field_goals_made <int> 28, 32, 29, 29, 29, 37, 31, 33, 35, …
## $ field_goals_attempted <int> 72, 65, 68, 66, 71, 75, 66, 72, 73, …
## $ flagrant_fouls <int> 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, …
## $ fouls <int> 16, 25, 24, 21, 14, 15, 17, 12, 25, …
## $ free_throw_pct <dbl> 82.9, 89.5, 92.0, 74.2, 83.3, 69.2, …
## $ free_throws_made <int> 29, 17, 23, 23, 15, 9, 10, 14, 21, 2…
## $ free_throws_attempted <int> 35, 19, 25, 31, 18, 13, 13, 20, 24, …
## $ largest_lead <chr> "20", "0", "17", "5", "8", "22", "9"…
## $ offensive_rebounds <int> 10, 8, 12, 10, 8, 9, 6, 8, 12, 6, 4,…
## $ points_in_paint <chr> "28", "48", "30", "40", "42", "40", …
## $ steals <int> 8, 3, 8, 5, 9, 9, 4, 9, 4, 9, 8, 2, …
## $ team_turnovers <int> 0, 0, 2, 0, 0, 0, 2, 2, 2, 1, 4, 0, …
## $ technical_fouls <int> 0, 5, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, …
## $ three_point_field_goal_pct <dbl> 38.7, 27.8, 37.5, 33.3, 17.9, 34.8, …
## $ three_point_field_goals_made <int> 12, 5, 9, 7, 5, 8, 14, 9, 7, 11, 9, …
## $ three_point_field_goals_attempted <int> 31, 18, 24, 21, 28, 23, 36, 27, 17, …
## $ total_rebounds <int> 32, 41, 36, 33, 34, 43, 35, 33, 40, …
## $ total_technical_fouls <int> 0, 5, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, …
## $ total_turnovers <int> 7, 18, 10, 12, 11, 13, 14, 7, 21, 8,…
## $ turnover_points <chr> "6", "26", "10", "16", "14", "18", "…
## $ turnovers <int> 7, 18, 8, 12, 11, 13, 12, 5, 19, 7, …
## $ opponent_team_id <int> 11, 17, 11, 17, 17, 11, 17, 11, 17, …
## $ opponent_team_uid <chr> "s:40~l:59~t:11", "s:40~l:59~t:17", …
## $ opponent_team_slug <chr> "phoenix-mercury", "las-vegas-aces",…
## $ opponent_team_location <chr> "Phoenix", "Las Vegas", "Phoenix", "…
## $ opponent_team_name <chr> "Mercury", "Aces", "Mercury", "Aces"…
## $ opponent_team_abbreviation <chr> "PHX", "LV", "PHX", "LV", "LV", "PHX…
## $ opponent_team_display_name <chr> "Phoenix Mercury", "Las Vegas Aces",…
## $ opponent_team_short_display_name <chr> "Mercury", "Aces", "Mercury", "Aces"…
## $ opponent_team_color <chr> "3c286e", "a7a8aa", "3c286e", "a7a8a…
## $ opponent_team_alternate_color <chr> "e56020", "000000", "e56020", "00000…
## $ opponent_team_logo <chr> "https://a.espncdn.com/i/teamlogos/w…
## $ opponent_team_score <int> 86, 97, 88, 90, 91, 78, 89, 86, 107,…
WNBA full player box score seasons (2002-2025) ~ 5-30 seconds
tictoc::tic()
progressr::with_progress({
wnba_player_box <- wehoop::load_wnba_player_box()
})
tictoc::toc()## 0.419 sec elapsed
## [1] 312
nrow(wnba_player_box)## [1] 7140
Women’s college basketball full play-by-play seasons (2004-2026) ~ 45-90 seconds
tictoc::tic()
progressr::with_progress({
wbb_pbp <- wehoop::load_wbb_pbp()
})
tictoc::toc()## 15.438 sec elapsed
## [1] 6011
nrow(wbb_pbp)## [1] 2824090
Women’s college basketball full team box score seasons (2006-2026) ~ 5-30 seconds
tictoc::tic()
progressr::with_progress({
wbb_team_box <- wehoop::load_wbb_team_box()
})
tictoc::toc()## 0.459 sec elapsed
## [1] 6029
nrow(wbb_team_box)## [1] 12058
Women’s college basketball full player box score seasons (2006-2026) ~ 5-30 seconds
tictoc::tic()
progressr::with_progress({
wbb_player_box <- wehoop::load_wbb_player_box()
})
tictoc::toc()## 1.333 sec elapsed
## [1] 6029
nrow(wbb_player_box)## [1] 168228