do_prepare_data: Prepare ACB play-by-play data

View source: R/do_prepare_data.R

do_prepare_dataR Documentation

Prepare ACB play-by-play data

Description

Prepare the ACB play-by-play data to be analyzed in further steps. It involves correcting some inconsistencies and filtering some unnecessary information.

Usage

do_prepare_data(data, day_num, data_gsl, data_ginfo, game_code_excel)

Arguments

data

Source play-by-play data from a given game.

day_num

Day number.

data_gsl

Games' starting lineups.

data_ginfo

Games' basic information.

game_code_excel

Game code.

Value

Data frame. Each row represents the action happened in the game. It has associated a player, a time point and the game score. The team column refers to the team to which the player belongs.

Note

1. Actions are given in Spanish. A bilingual basketball vocabulary (Spanish/English) is provided in https://www.uv.es/vivigui/docs/basketball_dictionary.xlsx.

2. 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 %>%
  filter(period == "1C")

df1 <- do_prepare_data(df0, day_num, 
                       acb_games_2223_sl, acb_games_2223_info,
                       game_code)
#df1                        


BAwiR documentation built on Nov. 14, 2023, 5:08 p.m.