005: Carolina Football Expectations

gt_plt_bullet
Published

December 7, 2022

Make data

Code
# data was manually created because lack of reliability in cfbfastR 
# requires an espn insider subscription
tibble::tribble(
     ~Season,~Pre,~Final,~OFF,~DEF,~ST, 
     2022,38,52,14,106,35,
     2021,11,59,11,101,55,
     2020,18,12,6,53,24,
     2019,66,30,25,44,74
    ) -> unc_sp

# manually created via vegasinsider
tibble::tribble(
     ~Season,~Pre,~Wins,
     2022,7.5,9,
     2021,10,6,
     2020,7.5,8,
     2019,4.5,7,
    ) -> unc_win_totals


# load csv from betiq / teamrankings 
mack <- read_csv("mack_spread.csv")

away_spread <- read_csv("mack_away.csv")

Make the tables

Code
# make the win total plot 

wt <- unc_win_totals %>%
  mutate(Actual = Pre, target_col = Wins) %>%
  select(Season, Pre, Wins, Actual, target_col) %>%
  gt() %>%
  cols_label(Pre = "Preseason Total",
             Actual = "Performance",
             Wins = "Actual Wins") %>%
  gt_plt_bullet(
    column = Actual,
    target = target_col,
    width = 45,
    palette = c("#d38956", "#56a0d3")
  ) %>%
  cols_width(4 ~ px(250)) %>%
  tab_header(
    title = "Preseason Win Totals and Actual Wins",
    subtitle = md(
      "Shows the <span style='color:#d38956; font-weight:bold'>preseason win total</span> and <span style='color:#56a0d3; font-weight:bold'>actual wins</span> during the season."
    )
  ) %>%
  tab_source_note(source_note = "@dadgumboxscores | data via vegasinsider.com")  %>%
  # adjust font sizes
  tab_options (source_notes.font.size = px(10),
               table.font.size = px(12),
  ) %>%
  gt_theme_538() 

wt
Preseason Win Totals and Actual Wins
Shows the preseason win total and actual wins during the season.
Season Preseason Total Actual Wins Performance
2022 7.5 9
2021 10.0 6
2020 7.5 8
2019 4.5 7
@dadgumboxscores | data via vegasinsider.com
Code
# make the sp+ table 
sp_unc <- unc_sp %>%
  mutate(Performance = Pre, target_col = Final) %>%
  select(Season, Pre, Final, Performance, target_col) %>%
  gt() %>%
  cols_label(Pre = "Projected") %>%
  gt_plt_bullet(
    column = Performance,
    target = target_col,
    width = 45,
    palette = c("#d38956", "#56a0d3")
  ) %>%
  tab_header(
    title = "SP+ Preseason Ranking and Final Ranking",
    subtitle = html(
      "Shows the <span style='color:#d38956; font-weight:bold'>preseason</span> and <span style='color:#56a0d3; font-weight:bold'>final SP+</span> rankings."
    )
  ) %>%
  tab_source_note(source_note = "@dadgumboxscores | data via ESPN")  %>%
  # adjust font sizes
  tab_options (source_notes.font.size = px(10),
               table.font.size = px(12),
  ) %>%
  tab_footnote(footnote = "Post-bowl ranking for all seasons except 2022.",
               locations = cells_column_labels(columns = Final)) %>%
  gt_theme_538()

sp_unc
SP+ Preseason Ranking and Final Ranking
Shows the preseason and final SP+ rankings.
Season Projected Final1 Performance
2022 38 52
2021 11 59
2020 18 12
2019 66 30
@dadgumboxscores | data via ESPN
1 Post-bowl ranking for all seasons except 2022.
Code
# make the spread table and minipulate the data
mack %>%
  mutate(
    Result = if_else(Opp > Pts, "L", "W"),
    OU = if_else(Combined > Total, "Over", "Under")
  ) %>%
  mutate(
    Opponent = case_when(
      Opponent == "VA Tech" ~ "Virginia Tech",
      Opponent == "GA Tech" ~ "Georgia Tech",
      Opponent == "S Carolina" ~ "South Carolina",
      Opponent == "Miami (FL)" ~ "Miami",
      Opponent == "Boston Col" ~ "Boston College",
      Opponent == "Florida St" ~ "Florida State",
      Opponent == "App State" ~ "Appalachian State",
      TRUE ~ Opponent
    )
  ) %>%
  select(Date, Opponent, Location, Result, Pts, Opp, Spread, ATS, Total, OU) -> mack_table

mack_spread <- mack_table %>%
  gt() %>%
  cols_label(OU = "O/U") %>%
  data_color(# Update cell colors...
    columns = c(ATS),
    # ...for supp column!
    colors = scales::col_factor(
      # <- bc it's a factor
      palette = c("#ffffff", "#daeaf5"),
      # Two factor levels, two colors
      domain = c("L", "W")# Levels
    )) %>%
  data_color(# Update cell colors...
    columns = c(Result),
    # ...for supp column!
    colors = scales::col_factor(
      # <- bc it's a factor
      palette = c("#ffffff", "#daeaf5"),
      # Two factor levels, two colors
      domain = c("L", "W")# Levels
    )) %>%
  fmt(
    columns = c(Spread),
    fns = function(x) {
      ifelse(x > 0, paste0("+", x), x)
    }
  ) %>%
  gt_highlight_rows(
    rows = c(3, 13, 19, 21, 32),
    fill = "lightpink",
    bold_target_only = TRUE,
    target_col = c("Result", "Spread"),
  ) %>%
  tab_header(title = "Carolina is 23-24 against the spread under Mack Brown 2.0",
             subtitle = "Result, point-spread, and total for each game against an FBS opponent since 2019.") %>%
  tab_source_note(source_note = "@dadgumboxscores | data via BetIQ (TeamRankings)")  %>%
  gt_theme_538() 

mack_spread
Carolina is 23-24 against the spread under Mack Brown 2.0
Result, point-spread, and total for each game against an FBS opponent since 2019.
Date Opponent Location Result Pts Opp Spread ATS Total O/U
12/3/22 Clemson Neutral L 10 39 +7 L 64.0 Under
11/25/22 NC State Home L 27 30 -6.5 L 56.0 Over
11/19/22 Georgia Tech Home L 17 21 -21.5 L 63.5 Under
11/12/22 Wake Forest Away W 36 34 +4.5 W 79.0 Under
11/5/22 Virginia Away W 31 28 -7 L 61.5 Under
10/29/22 Pittsburgh Home W 42 24 -2.5 W 65.5 Over
10/15/22 Duke Away W 38 35 -7 L 70.0 Over
10/8/22 Miami Away W 27 24 +4 W 67.5 Under
10/1/22 Virginia Tech Home W 41 10 -9.5 W 57.0 Under
9/24/22 Notre Dame Home L 32 45 -2.5 L 55.0 Over
9/10/22 Georgia State Away W 35 28 -7 W 64.0 Under
9/3/22 Appalachian State Away W 63 61 +3 W 56.0 Over
12/30/21 South Carolina Neutral L 21 38 -12 L 57.5 Over
11/26/21 NC State Away L 30 34 +5 W 61.5 Over
11/11/21 Pittsburgh Away L 23 30 +6.5 L 72.0 Under
11/6/21 Wake Forest Home W 58 55 -2.5 W 78.0 Over
10/30/21 Notre Dame Away L 34 44 +3.5 L 62.5 Over
10/16/21 Miami Home W 45 42 -7.5 L 63.5 Over
10/9/21 Florida State Home L 25 35 -17.5 L 64.5 Under
10/2/21 Duke Home W 38 7 -19.5 W 74.0 Under
9/25/21 Georgia Tech Neutral L 22 45 -14.5 L 66.0 Over
9/18/21 Virginia Home W 59 39 -7.5 W 66.5 Over
9/11/21 Georgia State Home W 59 17 -26 W 65.0 Over
9/3/21 Virginia Tech Away L 10 17 -5.5 L 63.5 Under
1/2/21 Texas A&M Neutral L 27 41 +7.5 L 65.5 Over
12/12/20 Miami Away W 62 26 +3 W 72.0 Over
11/27/20 Notre Dame Home L 17 31 +4.5 L 69.5 Under
11/14/20 Wake Forest Home W 59 53 -13 L 70.5 Over
11/7/20 Duke Away W 56 24 -11.5 W 63.5 Over
10/31/20 Virginia Away L 41 44 -8 L 61.0 Over
10/24/20 NC State Home W 48 21 -15 W 61.5 Over
10/17/20 Florida State Away L 28 31 -13.5 L 64.5 Under
10/10/20 Virginia Tech Home W 56 45 -3 W 58.5 Over
10/3/20 Boston College Away W 26 22 -14.5 L 52.0 Under
9/12/20 Syracuse Home W 31 6 -24 W 66.5 Under
12/27/19 Temple Neutral W 55 13 -6 W 56.0 Over
11/30/19 NC State Away W 41 10 -11 W 57.5 Under
11/14/19 Pittsburgh Away L 27 34 +4 L 48.5 Over
11/2/19 Virginia Home L 31 38 +1 L 48.0 Over
10/26/19 Duke Home W 20 17 -3 W 53.0 Under
10/19/19 Virginia Tech Away L 41 43 -4.5 L 57.0 Over
10/5/19 Georgia Tech Away W 38 22 -10 W 47.0 Over
9/28/19 Clemson Home L 20 21 +27.5 W 60.0 Under
9/21/19 Appalachian State Home L 31 34 -2 L 58.0 Over
9/13/19 Wake Forest Away L 18 24 +3 L 65.0 Under
9/7/19 Miami Home W 28 25 +5 W 46.0 Over
8/31/19 South Carolina Neutral W 24 20 +12.5 W 62.0 Under
@dadgumboxscores | data via BetIQ (TeamRankings)
Code
away_spread %>%
  mutate(
    Result = if_else(Opp > Pts, "L", "W"),
    OU = if_else(Combined > Total, "Over", "Under")
  ) %>%
  mutate(
    Opponent = case_when(
      Opponent == "VA Tech" ~ "Virginia Tech",
      Opponent == "GA Tech" ~ "Georgia Tech",
      Opponent == "S Carolina" ~ "South Carolina",
      Opponent == "Miami (FL)" ~ "Miami",
      Opponent == "Boston Col" ~ "Boston College",
      Opponent == "Florida St" ~ "Florida State",
      Opponent == "App State" ~ "Appalachian State",
      TRUE ~ Opponent
    )
  ) %>%
  select(Date, Opponent, Location, Result, Pts, Opp, Spread, ATS, Total, OU) -> mack_away

away_spread_games <- mack_away %>%
  gt() %>%
  cols_label(OU = "O/U") %>%
  data_color(# Update cell colors...
    columns = c(ATS),
    # ...for supp column!
    colors = scales::col_factor(
      # <- bc it's a factor
      palette = c("#ffffff", "#daeaf5"),
      # Two factor levels, two colors
      domain = c("L", "W")# Levels
    )) %>%
  data_color(# Update cell colors...
    columns = c(Result),
    # ...for supp column!
    colors = scales::col_factor(
      # <- bc it's a factor
      palette = c("#ffffff", "#daeaf5"),
      # Two factor levels, two colors
      domain = c("L", "W")# Levels
    )) %>%
  fmt(
    columns = c(Spread),
    fns = function(x) {
      ifelse(x > 0, paste0("+", x), x)
    }
  ) %>%
  tab_header(title = "Carolina is 7-11 against the spread on the road in ACC games under Mack Brown 2.0",
             subtitle = "Result, point-spread, and total for each game against an FBS opponent since 2019.") %>%
  tab_source_note(source_note = "@dadgumboxscores | data via BetIQ (TeamRankings)")  %>%
  gt_theme_538() 

away_spread_games
Carolina is 7-11 against the spread on the road in ACC games under Mack Brown 2.0
Result, point-spread, and total for each game against an FBS opponent since 2019.
Date Opponent Location Result Pts Opp Spread ATS Total O/U
11/12/22 Wake Forest Away W 36 34 +4.5 W 79.0 Under
11/5/22 Virginia Away W 31 28 -7 L 61.5 Under
10/15/22 Duke Away W 38 35 -7 L 70.0 Over
10/8/22 Miami Away W 27 24 +4 W 67.5 Under
11/26/21 NC State Away L 30 34 +5 W 61.5 Over
11/11/21 Pittsburgh Away L 23 30 +6.5 L 72.0 Under
10/30/21 Notre Dame Away L 34 44 +3.5 L 62.5 Over
9/3/21 Virginia Tech Away L 10 17 -5.5 L 63.5 Under
12/12/20 Miami Away W 62 26 +3 W 72.0 Over
11/7/20 Duke Away W 56 24 -11.5 W 63.5 Over
10/31/20 Virginia Away L 41 44 -8 L 61.0 Over
10/17/20 Florida State Away L 28 31 -13.5 L 64.5 Under
10/3/20 Boston College Away W 26 22 -14.5 L 52.0 Under
11/30/19 NC State Away W 41 10 -11 W 57.5 Under
11/14/19 Pittsburgh Away L 27 34 +4 L 48.5 Over
10/19/19 Virginia Tech Away L 41 43 -4.5 L 57.0 Over
10/5/19 Georgia Tech Away W 38 22 -10 W 47.0 Over
9/13/19 Wake Forest Away L 18 24 +3 L 65.0 Under
@dadgumboxscores | data via BetIQ (TeamRankings)