Learn R Programming

BAwiR (version 1.5)

do_sub_lineup: Compute sub-lineups

Description

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

Usage

do_sub_lineup(data, elem_choose, col_diff_points = FALSE)

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

Arguments

data

Data frame with the lineups (quintets).

elem_choose

Numeric: 4, 3, 2 or 1.

col_diff_points

Logical to indicate if data contains a column called diff_points.

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)    

df3 <- do_sub_lineup(df2, 4)
#df3

Run the code above in your browser using DataLab