# load csv
# schedule <- get_team_schedule(season = "2022-23", team.name = "North Carolina")
# play_by_play <- get_play_by_play(schedule$Game_ID)
# lineups <- get_lineups(play_by_play_data = play_by_play)
# no_rj <- get_player_combos(Lineup_Data = lineups, n = 5, min_mins = 0, Included = "CALEB.LOVE", Excluded = "RJ.DAVIS")
# no_rj %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 582
# no_caleb <- get_player_combos(Lineup_Data = lineups, n = 5, min_mins = 0, Excluded = "CALEB.LOVE", Included = "RJ.DAVIS")
# no_caleb %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 495
# both <- get_player_combos(Lineup_Data = lineups, n = 5, min_mins = 0, Included = c("CALEB.LOVE", "RJ.DAVIS"))
# both %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 3501
# neither <- get_player_combos(Lineup_Data = lineups, n = 5, min_mins = 0, Excluded = c("CALEB.LOVE", "RJ.DAVIS"))
# neither %>% filter(Team == "North Carolina") %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 92
# schedule_hub_one <- get_team_schedule(season = "2021-22", team.name = "North Carolina")
# pbp_hub_one <- get_play_by_play(schedule_hub_one$Game_ID)
# lineups_hub_one <- get_lineups(play_by_play_data = pbp_hub_one)
# no_rj_hub_one <- get_player_combos(Lineup_Data = lineups_hub_one, n = 5, min_mins = 0, Included = "CALEB.LOVE", Excluded = "RJ.DAVIS")
# no_rj_hub_one %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 702
# no_caleb_hub_one <- get_player_combos(Lineup_Data = lineups_hub_one, n = 5, min_mins = 0, Excluded = "CALEB.LOVE", Included = "RJ.DAVIS")
# no_caleb_hub_one %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 630
# both_hub_one <- get_player_combos(Lineup_Data = lineups_hub_one, n = 5, min_mins = 0, Included = c("CALEB.LOVE", "RJ.DAVIS"))
# both_hub_one %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 3990
# neither_hub_one <- get_player_combos(Lineup_Data = lineups_hub_one, n = 5, min_mins = 0, Excluded = c("CALEB.LOVE", "RJ.DAVIS"))
# neither_hub_one %>% filter(Team == "North Carolina") %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 232
# schedule_roy <- get_team_schedule(season = "2020-21", team.name = "North Carolina")
# pbp_roy <- get_play_by_play(schedule_roy$Game_ID)
# lineups_roy <- get_lineups(play_by_play_data = pbp_roy)
# no_rj_roy <- get_player_combos(Lineup_Data = lineups_roy, n = 5, min_mins = 0, Included = "CALEB.LOVE", Excluded = "RJ.DAVIS")
# no_rj_roy %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 1800
# no_caleb_roy <- get_player_combos(Lineup_Data = lineups_roy, n = 5, min_mins = 0, Excluded = "CALEB.LOVE", Included = "RJ.DAVIS")
# no_caleb_roy %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 1163
# both_roy <- get_player_combos(Lineup_Data = lineups_roy, n = 5, min_mins = 0, Included = c("CALEB.LOVE", "RJ.DAVIS"))
# both_roy %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 1136
# neither_roy <- get_player_combos(Lineup_Data = lineups_roy, n = 5, min_mins = 0, Excluded = c("CALEB.LOVE", "RJ.DAVIS"))
# neither_roy %>% filter(Team == "North Carolina") %>% summarise(total_p = sum(oPOSS) + sum(dPOSS))
# A tibble: 1 × 2
# Team total_p
# <chr> <dbl>
# 1 North Carolina 77
hello <- tibble::tribble(
~ type,
~ poss,
~ season,
"Love",
582,
2023,
"Davis",
495,
2023,
"Both",
3501,
2023,
"Neither",
92,
2023,
"Love",
702,
2022,
"Davis",
630,
2022,
"Both",
3990,
2022,
"Neither",
232,
2022,
"Love",
1800,
2021,
"Davis",
1163,
2021,
"Both",
1136,
2021,
"Neither",
77,
2021
)
pct <- hello %>%
group_by(season) %>%
mutate(
pct = (poss / sum(poss) * 100),
label = case_match(
type,
"Both" ~ "Together ON Court",
"Neither" ~ "Together OFF Court",
"Love" ~ "Love WITHOUT Davis",
"Davis" ~ "Davis WITHOUT Love"
)
)