Draws borders between every column and every row of a gt table, giving it a
full grid, with an option to extend the borders around the column and row
labels.
Details
Column borders are drawn as right cell borders on every column but
the last, and the row borders are added as scoped CSS on the .gt_row top
border. A table id is resolved or generated first, since that CSS is keyed on
#<table_id>.
Examples
library(gt)
afc_south <- subset(
sdv_example_standings, division == "AFC South",
c(team_name, wins:points_against)
)
gt(afc_south) |> gt_border_grid()
team_name
wins
losses
ties
win_pct
points_for
points_against
# heavier gray lines, including around the labels
pacific <- subset(
sdv_example_standings, division == "Pacific",
c(team_name, wins, losses, win_pct:points_against)
)
gt(pacific) |>
gt_border_grid(color = "#BBBBBB", weight = 2, include_labels = TRUE)
points_against
