-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathejected.R
45 lines (30 loc) · 999 Bytes
/
ejected.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#Use wehoop package to download WNBA or NCAAW data, and translate into format to use with BasketballAnalyzeR package
#https://wehoop.sportsdataverse.org/articles/getting-started-wehoop.html
# You can install using the pacman package using the following code:
if (!requireNamespace('pacman', quietly = TRUE)){
install.packages('pacman')
}
pacman::p_load(wehoop, dplyr, glue, tictoc, progressr)
#equivalent in NCAAW:
tictoc::tic()
progressr::with_progress({
wbb_pbp <- wehoop::load_wbb_pbp()
})
tictoc::toc()
tictoc::tic()
progressr::with_progress({
wbb_team_box <- wehoop::load_wbb_team_box()
})
tictoc::toc()
tictoc::tic()
progressr::with_progress({
wbb_player_box <- wehoop::load_wbb_player_box()
})
tictoc::toc()
library(BasketballAnalyzeR)
subset(wbb_player_box, ejected==TRUE)
#sc vs lsu game id 401629646
subset(wbb_player_box, game_id== 401629646)$ejected
player_box <- espn_wbb_game_all(401629646)$Player
subset(wbb_pbp, game_id== 401629646)$text
wbb_player_box$ejected