do_possession {BAwiR} | R Documentation |
Compute when possessions start
Description
Compute when the possession starts for each team during each period of a game.
Usage
do_possession(data, period_sel)
Arguments
data |
Play-by-play prepared data from a given game. |
period_sel |
Period of interest. Options can be "xC", where x=1,2,3,4. |
Value
Data frame. This is the meaning of the columns that might not be explanatory by themselves:
time_start: Time point when the action starts. time_end: Time point when the action ends. poss_time: Duration of the possession. possession: Indicates when the possession starts. This is encoded with the Spanish word inicio (start, in English). points: Number of points scored from a given action.
Note
1. A possession lasts 24 seconds in the ACB league.
2. Actions are given in Spanish. A bilingual basketball vocabulary (Spanish/English) is provided in https://www.uv.es/vivigui/docs/basketball_dictionary.xlsx.
3. The game_code column allows us to detect the source website, for example, https://jv.acb.com/es/103389/jugadas.
Author(s)
Guillermo Vinue
Examples
library(dplyr)
df0 <- acb_vbc_cz_pbp_2223
day_num <- unique(acb_vbc_cz_pbp_2223$day)
game_code <- unique(acb_vbc_cz_pbp_2223$game_code)
acb_games_2223_sl <- acb_vbc_cz_sl_2223 %>%
dplyr::filter(period == "1C")
df1 <- do_prepare_data(df0, day_num,
acb_games_2223_sl, acb_games_2223_info,
game_code)
df2 <- do_possession(df1, "1C")
#df2