do_lineup: Compute ACB lineups

View source: R/do_lineup.R

do_lineupR Documentation

Compute ACB lineups

Description

Compute all the lineups that a given team shows during a game.

Usage

do_lineup(data, day_num, game_code, team_sel, verbose)

Arguments

data

Play-by-play prepared data from a given game.

day_num

Day number.

game_code

Game code.

team_sel

One of the teams' names involved in the game.

verbose

Logical. Decide if information of the computations must be provided or not.

Value

Data frame. Each row is a different lineup. This is the meaning of the columns that might not be explanatory by themselves:

team_in: Time point when that lineup starts playing together. team_out: Time point when that lineup stops playing together (because there is a substitution). num_players: Number of players forming the lineup (must be 5 in this case). time_seconds: Total of seconds that the lineup played. diff_points: Game score in the time that the lineup played. plus_minus: Plus/minus achieved by the lineup. This is the difference between the game score of the previous lineup and of the current one. plus_minus_poss: Plus/minus per possession.

Note

A possession lasts 24 seconds in the ACB league.

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)
                
df2 <- do_lineup(df1, day_num, game_code, "Valencia Basket", FALSE)    
#df2


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