Code
library(cbbplotR)
<- readr::read_csv("dd.csv") dd
September 9, 2024
dd_chart <- dd |>
dplyr::filter(team %in% c("Notre Dame", "Miami", "Rice", "Air Force", "Clemson",
"Liberty", "N Carolina")) |>
dplyr::mutate(team = dplyr::case_match(team,
"N Carolina" ~ "North Carolina",
"Miami" ~ "Miami FL",
team ~ team),
opponent = dplyr::case_match(opponent,
"N Mex State" ~ "New Mexico State",
"Connecticut" ~ "UConn",
"VA Tech" ~ "Virginia Tech",
"Sam Hous St" ~ "Sam Houston State",
"Middle Tenn" ~ "Middle Tennessee State",
"GA Tech" ~ "Georgia Tech",
"S Carolina" ~ "South Carolina",
"N Illinois" ~ "Northern Illinois",
opponent ~ opponent)) |>
dplyr::mutate(score = dplyr::if_else(score == "23-Mar", "3-23", score),
score = dplyr::if_else(score == "28-Jul", "7-28", score),
score = paste0("L, ", score)) |>
dplyr::arrange(spread) |>
dplyr::select(team, date, opponent, spread, location = ...5, score) |>
cbbplotR::gt_cbb_teams(team, team) |>
gt::gt(groupname_col = "team",
row_group_as_column = TRUE,
process_md = TRUE) |>
gt::fmt_markdown(team) |>
gt::cols_label(
date = "Date",
opponent = "Opponent",
spread = "Spread",
location = "Location",
score = "Result",
) |>
gt::data_color(
columns = spread,
direction = c("column"),
method = c("numeric"),
palette = "OrRd",
reverse = TRUE
) |>
gtExtras::gt_add_divider(columns = c(team, opponent),
sides = "right", color = "black") |>
gt::tab_header(title = "Outright losses as a double-digit favorite",
subtitle = gt::html("Shows the seven teams that have at least three outright losses as a double-digit favorite over past three seasons.")) |>
gt::tab_source_note(source_note = gt::html("<hr><br>
Data from TeamRankings BetIQ | Theme and logos from cbbplotR<br>
<br>
<hr>
<b>Table by Chris (@dadgumboxscores) + Bless your chart | September 10, 2024</b>")) |>
cbbplotR::gt_theme_athletic() |>
gt::cols_align(align = "left", columns = c(date, opponent, location, score)) |>
gt::tab_style(
style = gt::cell_borders(sides = "top", color = 'black', weight = gt::px(1.5), style = 'solid'),
locations = gt::cells_body(
rows = gt::everything()
)
) |>
gt::tab_options(
heading.align = "left",
) |>
gt::tab_style(
locations = gt::cells_row_groups(groups = gt::everything()),
style = list(
gt::cell_text(
align = "left"
),
gt::cell_borders(sides = c("top", "right"), color = "black", weight = gt::px(2))
)) |>
gt::tab_style(
style = gt::cell_borders(
sides = "top",
color = 'black',
weight = gt::px(3.5),
style = 'solid'
),
locations = gt::cells_body(rows = c(2, 3, 4, 7, 12, 13))
) |>
gt::tab_options(
table.width = gt::pct(55),
)
gtExtras::gtsave_extra(
dd_chart,
filename = "dd_chart.png",
vwidth = 100
)
dd_chart
Outright losses as a double-digit favorite | |||||
---|---|---|---|---|---|
Shows the seven teams that have at least three outright losses as a double-digit favorite over past three seasons. | |||||
Date | Opponent | Spread | Location | Result | |
Notre Dame |
9/7/24 | Northern Illinois | -27.5 | Home | L, 14-16 |
9/10/22 | Marshall | -20.5 | Home | L, 21-26 | |
10/15/22 | Stanford | -16.5 | Home | L, 14-16 | |
Miami FL |
9/24/22 | Middle Tennessee State | -25.5 | Home | L, 31-45 |
10/7/23 | Georgia Tech | -19.0 | Home | L, 20-23 | |
10/22/22 | Duke | -10.0 | Home | L, 21-45 | |
Liberty |
11/26/22 | New Mexico State | -24.0 | Home | L, 14-49 |
11/12/22 | UConn | -13.5 | Away | L, 33-36 | |
11/19/22 | Virginia Tech | -10.5 | Home | L, 22-23 | |
North Carolina |
10/21/23 | Virginia | -24.0 | Home | L, 27-31 |
11/19/22 | Georgia Tech | -21.5 | Home | L, 17-21 | |
10/28/23 | Georgia Tech | -12.0 | Away | L, 42-46 | |
Air Force |
11/11/23 | Hawaii | -20.0 | Away | L, 13-27 |
11/4/23 | Army | -18.5 | Neutral | L, 3-23 | |
9/16/22 | Wyoming | -16.5 | Away | L, 14-17 | |
10/8/22 | Utah St | -11.5 | Away | L, 27-34 | |
Rice |
10/29/22 | Charlotte | -15.0 | Home | L, 23-56 |
8/31/24 | Sam Houston State | -10.0 | Home | L, 14-34 | |
10/7/23 | UConn | -10.0 | Home | L, 31-38 | |
Clemson |
11/26/22 | South Carolina | -14.0 | Home | L, 30-31 |
9/4/23 | Duke | -12.0 | Away | L, 7-28 | |
10/28/23 | NC State | -10.0 | Away | L, 17-24 | |
Data from TeamRankings BetIQ | Theme and logos from cbbplotR Table by Chris (@dadgumboxscores) + Bless your chart | September 10, 2024 |
cfbfastR::cfbd_drives(week = 2, year = 2024) |>
dplyr::filter(game_id == "401628977") |>
dplyr::mutate(
available_yards = dplyr::if_else(yards < 0, 0, yards / start_yards_to_goal),
time_seconds_elapsed = stringr::str_pad(time_seconds_elapsed, width = 2, pad = "0"),
plays_yards = paste0(
plays,
" plays, ",
yards,
" yards",
"<br>",
time_minutes_elapsed,
":",
time_seconds_elapsed
),
yds_play = round(yards / plays, 2),
points = end_offense_score - start_offense_score,
drive_start = dplyr::if_else(
start_yards_to_goal > 50,
100 - start_yards_to_goal,
start_yards_to_goal
),
drive_end = dplyr::if_else(
offense == "Northern Illinois" & end_yardline != 0,
100 - end_yardline,
end_yardline
),
drive_end = dplyr::if_else(
offense == "Northern Illinois" & end_yardline == 0,
100,
end_yardline
)
) |>
dplyr::select(
offense,
defense,
drive_number,
qrt = start_period,
drive_start,
drive_end,
plays_yards,
drive_result,
points,
yds_play,
available_yards
) |>
cbbplotR::gt_cbb_teams(offense, offense) -> nd_drives
custom_header <- glue::glue(
"<div style='display: flex; justify-content: space-between; align-items: center;'>
<div>
<img src='https://a.espncdn.com/combiner/i?img=/i/teamlogos/ncaa/500/2459.png'
style='height: 55px; width: auto; vertical-align: middle;'>
<span style='display: block; text-align: left; font-size: 14px;'>
<br>
<b>Total drives</b>: 10<br>
<b>Scoring drives</b>: 4<br>
<b>Avg. start</b>: Own 29
</span>
</div>
<div style='flex-grow:1; margin-left: 30px; margin-right: 30px'>
<span style='display: block; font-weight: bold; text-align: center; font-size: 24px;'>Northern Illinois 16, Notre Dame 14</span>
<span style='font-size: 14px; font-weight: normal; display: block; text-align: center;'>Drive chart showing each team's possessions and available yards gained.</span>
</div>
<div>
<img src='https://a.espncdn.com/combiner/i?img=/i/teamlogos/ncaa/500/87.png'
style='height: 55px; width: auto; vertical-align: middle;'>
<span style='display: block; text-align: left; font-size: 14px;'>
<br>
<b>Total drives</b>: 11<br>
<b>Scoring drives</b>: 2<br>
<b>Avg. start</b>: Own 31
</span>
</div>
</div>
<br>"
)
nd_drives |>
gt::gt(
groupname_col = "offense",
row_group_as_column = TRUE,
process_md = TRUE,
rowname_col = "row",
) |>
gt::fmt_markdown(offense) |>
gt::cols_hide(columns = c(defense, drive_number, qrt)) |>
gtExtras::gt_merge_stack(
col1 = drive_result,
col2 = plays_yards,
palette = c("black", "#333333")
) |>
gtExtras::gt_plt_bar_pct(column = available_yards,
labels = TRUE,
fill = "lightgreen") |>
gt::fmt_number(columns = yds_play, decimals = 1) |>
gt::tab_spanner(columns = c(drive_start, drive_end, drive_result),
label = "Drives") |>
gt::tab_spanner(columns = c(points, yds_play, available_yards),
label = "Performance") |>
gt::cols_label(
drive_start = "Start",
drive_end = "End",
points = "Points",
drive_result = "Result",
yds_play = "Yds/Play",
available_yards = "Available Yards"
) |>
gt::data_color(
columns = points,
direction = c("column"),
method = c("numeric"),
palette = "YlGn"
) |>
gtExtras::gt_add_divider(columns = c(yds_play),
sides = "right",
color = "black") |>
gt::tab_header(title = gt::html(custom_header)) |>
gt::tab_source_note(
source_note = gt::html(
"<hr><br>
Data from cfbfastR | Theme and logos from cbbplotR<br>
Any negative drive results is capped at 0% of available yards gained.
<br>
Drives that end in opponent territory are greater than 50. For example, a drive ending on the 96 yard-line means the opponent's four yard-line.
<hr>
<b>Table by Chris (@dadgumboxscores) + Bless your chart | September 9, 2024</b>"
)
) |>
cbbplotR::gt_theme_savant() |>
gt::cols_align(align = "left", columns = c(drive_result)) |>
gt::tab_style(
style = gt::cell_borders(
sides = "top",
color = 'black',
weight = gt::px(1.5),
style = 'solid'
),
locations = gt::cells_body(rows = gt::everything())
) |>
gt::tab_style(
style = gt::cell_borders(
sides = "top",
color = 'black',
weight = gt::px(3.5),
style = 'solid'
),
locations = gt::cells_body(rows = c(2))
) |>
gt::tab_style(
style = list(
gt::cell_text(
color = "#333333",
size = gt::px(12),
weight = "bold"
),
gt::cell_borders(
sides = "bottom",
color = "black",
weight = gt::px(2)
)
),
locations = list(gt::cells_column_spanners(spanners = gt::everything()))
) |>
gt::tab_options(heading.align = "center", ) -> nd_chart
gtExtras::gtsave_extra(nd_chart,
filename = "nd_chart.png",
vwidth = 950,
expand = 10,
zoom = 5)
nd_chart
Total drives: 10 Scoring drives: 4 Avg. start: Own 29
Northern Illinois 16, Notre Dame 14 Drive chart showing each team's possessions and available yards gained.
Total drives: 11 Scoring drives: 2 Avg. start: Own 31 |
||||||
---|---|---|---|---|---|---|
Drives | Performance | |||||
Start | End | Result | Points | Yds/Play | Available Yards | |
Notre Dame |
25 | 100 |
TD
13 plays, 75 yards 6:25 |
7 | 5.8 |
100%
|
25 | 16 |
PUNT
3 plays, -9 yards 1:54 |
0 | −3.0 |
0%
|
|
37 | 49 |
INT
4 plays, 12 yards 1:16 |
0 | 3.0 |
19%
|
|
29 | 61 |
PUNT
6 plays, 32 yards 2:58 |
0 | 5.3 |
45.1%
|
|
30 | 53 |
PUNT
7 plays, 23 yards 3:03 |
0 | 3.3 |
32.9%
|
|
39 | 70 |
MISSED FG
9 plays, 31 yards 1:41 |
0 | 3.4 |
50.8%
|
|
36 | 100 |
TD
6 plays, 64 yards 2:43 |
7 | 10.7 |
100%
|
|
20 | 25 |
PUNT
3 plays, 5 yards 1:07 |
0 | 1.7 |
6.2%
|
|
30 | 35 |
PUNT
3 plays, 5 yards 1:26 |
0 | 1.7 |
7.1%
|
|
25 | 49 |
INT
4 plays, 24 yards 1:54 |
0 | 6.0 |
32%
|
|
37 | 56 |
MISSED FG
5 plays, 19 yards 0:24 |
0 | 3.8 |
30.2%
|
|
Northern Illinois |
2 | 100 |
TD
5 plays, 98 yards 2:51 |
7 | 19.6 |
100%
|
45 | 25 |
FG
5 plays, 30 yards 1:27 |
3 | 6.0 |
54.5%
|
|
45 | 4 |
FG
5 plays, 51 yards 2:08 |
3 | 10.2 |
92.7%
|
|
11 | 59 |
PUNT
8 plays, 30 yards 4:28 |
0 | 3.8 |
33.7%
|
|
12 | 79 |
PUNT
3 plays, 9 yards 1:24 |
0 | 3.0 |
10.2%
|
|
25 | 36 |
MISSED FG
8 plays, 39 yards 3:43 |
0 | 4.9 |
52%
|
|
25 | 41 |
PUNT
10 plays, 34 yards 5:49 |
0 | 3.4 |
45.3%
|
|
40 | 30 |
DOWNS
9 plays, 30 yards 4:27 |
0 | 3.3 |
50%
|
|
29 | 55 |
PUNT
5 plays, 16 yards 2:54 |
0 | 3.2 |
22.5%
|
|
50 | 19 |
FG
11 plays, 31 yards 5:24 |
3 | 2.8 |
62%
|
|
Data from cfbfastR | Theme and logos from cbbplotR Any negative drive results is capped at 0% of available yards gained. Drives that end in opponent territory are greater than 50. For example, a drive ending on the 96 yard-line means the opponent's four yard-line. Table by Chris (@dadgumboxscores) + Bless your chart | September 9, 2024 |