Learn R Programming

BAwiR (version 1.3.4)

do_lineup: 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)

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.

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.

Author

Guillermo Vinue

Examples

Run this code
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

Run the code above in your browser using DataLab