opt_table_lines: Option to set table lines to different extents

View source: R/opts.R

opt_table_linesR Documentation

Option to set table lines to different extents


The opt_table_lines() function sets table lines in one of three possible ways: (1) all possible table lines drawn ("all"), (2) no table lines at all ("none"), and (3) resetting to the default line styles ("default"). This is great if you want to start off with lots of lines and subtract just a few of them with tab_options() or tab_style(). Or, use it to start with a completely lineless table, adding individual lines as needed.


opt_table_lines(data, extent = c("all", "none", "default"))



The gt table data object

⁠obj:<gt_tbl>⁠ // required

This is the gt table object that is commonly created through use of the gt() function.


Extent of lines added

⁠singl-kw:[all|none|default]⁠ // default: "all"

The extent to which lines will be visible in the table. Options are "all", "none", or "default".


An object of class gt_tbl.


Use the exibble dataset to create a gt table with a number of table parts added (using functions like summary_rows(), grand_summary_rows(), and more). Following that, we'll use the opt_table_lines() function to generate lines everywhere there can possibly be lines (the default for the extent argument is "all").

exibble |>
  gt(rowname_col = "row", groupname_col = "group") |>
    groups = "grp_a",
    columns = c(num, currency),
    fns = c("min", "max")
  ) |>
    columns = currency,
    fns = total ~ sum(., na.rm = TRUE)
  ) |>
  tab_source_note(source_note = "This is a source note.") |>
    footnote = "This is a footnote.",
    locations = cells_body(columns = 1, rows = 1)
  ) |>
    title = "The title of the table",
    subtitle = "The table's subtitle"
  ) |>
This image of a table was generated from the first code example in the `opt_table_lines()` help file.

Function ID


Function Introduced

v0.2.0.5 (March 31, 2020)

See Also

Other table option functions: opt_align_table_header(), opt_all_caps(), opt_css(), opt_footnote_marks(), opt_footnote_spec(), opt_horizontal_padding(), opt_interactive(), opt_row_striping(), opt_stylize(), opt_table_font(), opt_table_outline(), opt_vertical_padding()

gt documentation built on Oct. 7, 2023, 9:07 a.m.