total_records |>
cbbplotR::gt_cbb_teams(team, team) |>
dplyr::arrange(-W, -full_diff)|>
gt::gt(groupname_col = "div")|>
gt::fmt_markdown(team) |>
gt::cols_label(
# rename columns
team = "",
rpi = "RPI",
o_w = "W",
o_l = "L",
full_diff = "+/-",
h_w = "W",
h_l = "L",
home_diff = "+/-",
a_w = "W",
a_l = "L",
away_diff = "+/-",
)|>
gt::tab_spanner(label = "Overall",
columns = c(rpi, o_w, o_l))|>
gt::tab_spanner(label = "ACC Only",
columns = c(W, L, full_diff))|>
gt::tab_spanner(label = "Home (ACC)",
columns = c(h_w, h_l, home_diff))|>
gt::tab_spanner(label = "Away (ACC)",
columns = c(a_w, a_l, away_diff))|>
gt::fmt(
columns = c(full_diff, home_diff, away_diff),
fns = function(x) {
ifelse(x > 0, paste0("+", x), x)
}
)|>
gtExtras::gt_hulk_col_numeric(columns = c(full_diff, away_diff, home_diff)) |>
gtExtras::gt_hulk_col_numeric(columns = c(rpi), reverse = TRUE) |>
gt::tab_header(title = "ACC Baseball Standings: League Records and Run Differentials by Location",
subtitle = "Shows RPI, overall record, and conference records by location with run differentials through May 18 games.") |>
gt::tab_source_note(source_note = gt::html("<hr><b>Table by Chris (@dadgumboxscores) + Bless your chart | data via baseballr and ncaa.org</b>")) |>
gt_theme_chris() |>
gt::tab_footnote(footnote =
gt::md(
"UNC clinched first place in Coastal Division."
),
locations = gt::cells_body(
columns = W,
rows = 1
)) |>
gt::cols_align(align = "left", columns = c(team)) |>
gtExtras::gt_add_divider(columns = c(o_l, full_diff, home_diff, away_diff),
sides = "right", color = "black") -> acc_tbl
gtExtras::gtsave_extra(acc_tbl,
filename = "acc_base_table.png",
vheight = 875,
vwidth = 875)
acc_tbl