do_sub_lineup: Compute ACB sub-lineups

View source: R/do_sub_lineup.R

do_sub_lineupR Documentation

Compute ACB sub-lineups

Description

Compute all the sub-lineups that a given team shows during a game. They can be made up of four, three or two players.

Usage

do_sub_lineup(data, elem_choose)

Arguments

data

Data frame with the lineups (quintets).

elem_choose

Numeric: 4, 3 or 2.

Value

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

team_in: Time point when that sub-lineup starts playing together. team_out: Time point when that sub-lineup stops playing together (because there is a substitution). time_seconds: Total of seconds that the sub-lineup played. plus_minus: Plus/minus achieved by the sub-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)    

df3 <- do_sub_lineup(df2, 4)
#df3


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