conf_margin |>
dplyr::mutate(row_number = 1:dplyr::n()) |>
dplyr::relocate(row_number, .before = team) |>
gt::gt() |>
gt::fmt_markdown(columns = c(team)) |>
gt::cols_label(
row_number = "",
team_name = "",
team = "",
delta = "+/-",
wins = "W",
loss = "L",
home_wins = "W",
home_loss = "L",
home_delta = "+/-",
away_wins = "W",
away_loss = "L",
away_delta = "+/-"
) |>
gt::tab_spanner(label = "Overall",
columns = c(wins, loss, delta)) |>
gt::tab_spanner(label = "Home",
columns = c(home_wins, home_loss, home_delta)) |>
gt::tab_spanner(label = "Away",
columns = c(away_wins, away_loss, away_delta)) |>
gt::fmt(
columns = c(delta, home_delta, away_delta),
fns = function(x) {
ifelse(x > 0, paste0("+", x), x)
}
) |>
gtExtras::gt_theme_dot_matrix() |>
gt::cols_align(align = "left", columns = "team_name") |>
gtExtras::gt_hulk_col_numeric(columns = c(delta, home_delta, away_delta)) |>
gt::tab_header(
title = gt::md(
"<img src='https://substackcdn.com/image/fetch/w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F19a014d5-5bf0-43a0-820d-b4224c32d88c_128x128.webp' style='height:30px;'> **ACC: Conference Standings and Point Differentials**"
),
subtitle = "Win/loss and point differential by location in conference play only."
) |>
gt::tab_source_note(
source_note = gt::html(
"Data through March 2, 2024 games. <br> <b>Bless your chart + @dadgumboxscores | data via cbbdata + cbbplotR</b>"
)
) |>
gt::tab_options (
source_notes.font.size = gt::px(10),
row.striping.background_color = '#EEEEEE',
table.font.size = gt::px(12),
column_labels.text_transform = 'uppercase'
) |>
gt::tab_style(style = list(gt::cell_borders(
sides = c("left"),
color = "#c1c1c1",
weight = gt::px(2)
)),
locations = list(gt::cells_body(
columns = c(
wins,
loss,
delta,
home_wins,
home_loss,
home_delta,
away_wins,
away_loss,
away_delta
)
))) -> conf_table
gtExtras::gtsave_extra(conf_table,
filename = "acc_table.png",
vheight = 875,
vwidth = 850)
conf_table