081: ACC Records

cbbplotR
gt
Published

March 2, 2024

Data

Code
library(cbbplotR)

conf_data <-
  cbbdata::cbd_torvik_game_stats(year = 2024, type = "conf") |> 
  dplyr::filter(conf == "ACC")

# Determine the margin for conference only games
conf_margin <- conf_data |>
  dplyr::group_by(team) |>
  dplyr::summarise(
    wins = sum(result == "W"),
    loss = sum(result == "L"),
    delta = sum(pts - opp_pts),
    home_wins = sum(result == "W" & location == "H"),
    home_loss = sum(result == "L" & location == "H"),
    home_delta = sum((pts - opp_pts) * (location == "H")),
    away_wins = sum(result == "W" & location == "A"),
    away_loss = sum(result == "L" & location == "A"),
    away_delta = sum((pts - opp_pts) * (location == "A"))
  ) |>
  dplyr::arrange(-wins,-delta) |>
  dplyr::mutate(team_name = team) |>
  dplyr::relocate(team_name, .before = wins) |>
  cbbplotR::gt_cbb_teams(team, include_name = FALSE)