unc_games <- readr::read_csv("unc_games.csv")pd <- unc_games |> dplyr::mutate(point_diff = dplyr::case_when( homeTeam =="North Carolina"~ homePoints - awayPoints, awayTeam =="North Carolina"~ awayPoints - homePoints ) )bad <- pd |> dplyr::mutate(result = dplyr::case_when(point_diff >0~"W", point_diff <0~"L", point_diff ==0~"T")) |> dplyr::group_by(season) |> dplyr::summarize(big_losses =sum(point_diff <=-23.5, na.rm =TRUE),wins =sum(result =="W", na.rm =TRUE),losses =sum(result =="L", na.rm =TRUE),ties =sum(result =="T", na.rm =TRUE),record =paste0(wins, "-", losses, ifelse(ties >0, paste0("-", ties), "")) ) |> dplyr::filter(big_losses >1) |> dplyr::arrange(-big_losses, -season)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/153.png' style='height: 45px; width: auto; vertical-align: middle;'> </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;'>North Carolina football <br>Seasons with multiple 24+ point losses since 1980</span> <span style='font-size: 12px; font-weight: normal; display: block; text-align: center;'>Shows seasons since 1980 where UNC has lost at least two games by 24 or more points.</span> </div> <div> <img src='https://a.espncdn.com/combiner/i?img=/redesign/assets/img/icons/ESPN-icon-football-college.png' style='height: 40px; width: auto; vertical-align: middle;'> </div> </div> <br>")unc_tbl <- bad |> dplyr::select(season, big_losses, record) |> dplyr::mutate(record = dplyr::if_else(record =="2-2", "2-2 (??)", record)) |> gt::gt() |> gtUtils::gt_theme_athletic() |> gtUtils::gt_column_subheaders(season =list(heading ="Season", subtitle ="Since 1980"),big_losses =list(heading ="# of Losses", subtitle ="By 24+ points"),record =list(heading ="Record", subtitle ="Final W-L-T"),heading_color ="black",subtitle_color ="gray" ) |> gt::tab_header(title = gt::html(custom_header)) |> gt::tab_source_note(source_note = gt::html("<hr>Data via collegefootballdata.com, theme via {gtUtils} and logo from ESPN.<br>2025 marks the 13th season over the past 36 seasons that Carolina has had multiple 24-point-plus losses in the same season.<hr><b>Table by Chris at Bless your Chart</b>" ) ) |> gtUtils::gt_border_bars_bottom(c("#56a0d3", "#89BDE0", "#BBD9ED")) |> gt::tab_options(table.width = gt::px(550)) |> gtUtils::gt_border_grid(color ="black",weight =1,include_labels =FALSE) |> gt::tab_style(locations = gt::cells_source_notes(),style = gt::cell_text(font = gt::google_font("Spline Sans Mono"),size = gt::px(11.5),weight =250 ) ) |> gt::tab_style(style =list(gt::cell_text(font = gt::google_font("Spline Sans Mono"))),locations = gt::cells_body(columns =everything()) ) |> gt::cols_align(columns =c(season), align ="right") |> gt::cols_align(columns =c(big_losses, record), align ="center") |> gtExtras::gt_highlight_rows(rows =c(8), fill ="#ffe9ec")gt_save_crop(unc_tbl,file ="big_loss_unc.png",whitespace =60,bg ="white")unc_tbl
North Carolina football
Seasons with multiple 24+ point losses since 1980Shows seasons since 1980 where UNC has lost at least two games by 24 or more points.
Season Since 1980
# of Losses By 24+ points
Record Final W-L-T
2002
5
3-9
1989
5
1-10
2014
3
6-7
2004
3
6-6
2003
3
2-10
1999
3
3-8
1988
3
1-10
2025
2
2-2 (??)
2017
2
3-9
2007
2
4-8
2006
2
3-9
2005
2
5-6
1986
2
7-4-1
Data via collegefootballdata.com, theme via {gtUtils} and logo from ESPN.
2025 marks the 13th season over the past 36 seasons that Carolina has had multiple 24-point-plus losses in the same season.
Table by Chris at Bless your Chart