Closed zenggyu closed 4 years ago
I just found that cells_borders()
may be the way to do it , but unfortunately it does not work as expected:
library(gt)
mtcars %>%
head() %>%
gt() %>%
tab_header("Table 1. mtcars dataset") %>%
tab_style(style = cell_borders(sides = "top", weight = px(0)),
locations = cells_title("title"))
Thanks, this is a really good suggestion! In gt, I think we eventually want to get to a point where every single line and cell can be accessed and modified (and we actually need this for theming).
Hi @zenggyu , this issue should be resolved now. Now you can take any gt table object and use these options (from tab_options()
):
gt_table %>%
tab_options(
table.border.top.style = "hidden",
table.border.bottom.style = "hidden"
)
There is an even more specific solution to remove the border below your footnotes:
gt_table |>
tab_options(
footnotes.border.bottom.style = "hidden"
)
Mentioning this because table.border.bottom.style = "hidden"
will also remove formatting of table borders you may have previously applied.
Please briefly describe your problem or your ideas for enhancement in the template below.
Have a question? Please don't use this form but instead ask on RStudio community, on Stack Overflow, or on Twitter (using the
#rstats
hashtag).When describing a bug, please include a minimal reproducible example (otherwise known as a reprex).
When posting, delete these explanatory lines and submit only the text derived from the template below.
Some academic journals require that borders of table header and table footer (see below for an example taken from the intro page) be removed before submission, but currently I don't see any option to do this in
gt
.I think it'd be nice to have such feature.