stub: Select helper for targeting the stub column

View source: R/helpers.R

stubR Documentation

Select helper for targeting the stub column


Should you need to target only the stub column for formatting or other operations, the stub() select helper can be used. This obviates the need to use the name of the column that was selected as the stub column.




A character vector of class "stub_column".


Create a tibble that has a row column (values from 1 to 6), a group column, and a vals column (containing the same values as in row).

tbl <-
    row = 1:6,
    group = c(rep("Group A", 3), rep("Group B", 3)),
    vals = 1:6

Create a gt table with a two-column stub (incorporating the row and group columns in that). Format the row labels of the stub with fmt_roman() to obtain Roman numerals in the stub; we're selecting the stub column here with the stub() select helper.

tbl |>
  gt(rowname_col = "row", groupname_col = "group") |>
  fmt_roman(columns = stub()) |>
  tab_options(row_group.as_column = TRUE)
This image of a table was generated from the first code example in the `stub()` help file.

Function ID


Function Introduced

v0.8.0 (November 16, 2022)

See Also

Other helper functions: adjust_luminance(), cell_borders(), cell_fill(), cell_text(), cells_body(), cells_column_labels(), cells_column_spanners(), cells_footnotes(), cells_grand_summary(), cells_row_groups(), cells_source_notes(), cells_stub_grand_summary(), cells_stub_summary(), cells_stubhead(), cells_stub(), cells_summary(), cells_title(), currency(), default_fonts(), define_units(), escape_latex(), from_column(), google_font(), gt_latex_dependencies(), html(), md(), nanoplot_options(), pct(), px(), random_id(), system_fonts()

gt documentation built on June 22, 2024, 11:11 a.m.